lib/sitefuel/processors/AbstractStringBasedProcessor.rb in sitefuel-0.1.0a vs lib/sitefuel/processors/AbstractStringBasedProcessor.rb in sitefuel-0.1.0b
- old
+ new
@@ -51,17 +51,29 @@
proc.open_string(string)
proc.generate_string
end
# opens a resource from a file
- def open_file(filename)
+ def open_file(filename, resource_name = nil)
info "#{self.class} opening #{filename}"
self.document = File.read(filename)
self.original_size = File.size(filename)
- self.resource_name = filename
+ case
+ when (resource_name == nil and @resource_name == nil)
+ @resource_name = filename
+
+ when @resource_name != nil
+ # just leave @resource_name be
+
+ else
+ @resource_name = resource_name
+ end
+
+ debug "\t\tOpened with resource name: '#{@resource_name}'"
+
return self
end
# opens a resource directly from a string
def open_string(string)
@@ -90,10 +102,10 @@
file_name = create_file(file_tree)
File.open(file_name, 'w') do |file|
file << @document
end
- info "Wrote document into #{file}"
+ info "Wrote document into #{file_name}"
end
attr_reader :document
protected
\ No newline at end of file