X-Git-Url: http://git.code-monkey.de/?p=redact.git;a=blobdiff_plain;f=lib%2Fredact%2Fredact.rb;h=f1a93faa0cd3b8667c11a48c549cda9062296cec;hp=7b9a802461c644048235570b3a8482df409f505d;hb=5509b434e26fd1a8c9c3990154a881583b81d2a6;hpb=bf303d7901b8d8105571f66c1fa4fb7f0907bed4 diff --git a/lib/redact/redact.rb b/lib/redact/redact.rb index 7b9a802..f1a93fa 100644 --- a/lib/redact/redact.rb +++ b/lib/redact/redact.rb @@ -1,6 +1,4 @@ #-- -# $Id: redact.rb 48 2005-06-08 21:38:34Z tilman $ -# # Copyright (c) 2005 Tilman Sauerbeck (tilman at code-monkey de) # # Permission is hereby granted, free of charge, to any person obtaining @@ -57,7 +55,7 @@ class String end module Redact - VERSION = "0.1.1" + VERSION = "0.1.5" class RedactError < StandardError; end @@ -142,12 +140,12 @@ module Redact end class FontDirectoryEntry # :nodoc: - attr_reader :filename, :alias + attr_reader :save_as, :filename, :alias - def initialize(filename) + def initialize(fn_alias, filename) + @save_as = fn_alias.to_str.dup.freeze @filename = filename.to_str.dup.freeze - @alias = "Edje." + File.basename(@filename). - sub(/.[^.]+$/, "").freeze + @alias = "Edje." + fn_alias.sub(/.[^.]+$/, "").freeze end protected @@ -180,7 +178,8 @@ module Redact class ImageDirectoryEntry # :nodoc: attr_reader :filename, :image, :id - def initialize(filename) + def initialize(im_alias, filename) + @alias = im_alias.to_str.dup.freeze @filename = filename.to_str.dup.freeze @image = Imlib2::Image.load(@filename) @id = -1 @@ -204,7 +203,7 @@ module Redact end def to_eet_properties - {"entry" => [@filename], + {"entry" => [@alias], "source_type" => [@source_type], "source_param" => [@source_param], "id" => [@id]} @@ -258,7 +257,8 @@ module Redact end def script=(v) - @script = v.to_str.dup + v = v.to_str + @script = (File.exist?(v) ? File.read(v) : v).dup end def part(name, type = :invalid) # :yields: part