lib/tori/file.rb in tori-0.0.4 vs lib/tori/file.rb in tori-0.0.5
- old
+ new
@@ -8,32 +8,32 @@
def name
Tori.config.filename_callback.call(@model)
end
alias to_s name
- def copy?
- !@model.nil? && !@from.nil? && @from.respond_to?(:path) && 0 < name.length
- rescue NameError => e
- false
+ def from?
+ !@from.nil? && @from.respond_to?(:path)
end
- def copy
- Tori.config.backend.copy @from.path, name if copy?
+ def write
+ path = @from.path
+ path = Pathname.new(path) if path.kind_of?(String)
+ Tori.config.backend.write name, path
end
def delete
Tori.config.backend.delete name if exist?
end
def respond_to_missing?(sym, include_private)
Tori.config.backend.respond_to?(sym, include_private)
end
- def method_missing(sym)
+ def method_missing(sym, *args)
if respond_to_missing?(sym, false)
- Tori.config.backend.__send__ sym, name
+ Tori.config.backend.__send__ sym, name, *args
else
- fail NameError, "undefined local variable or method `#{sym}' for #{Tori.config.backend.inspect}"
+ fail NameError, "undefined method `#{sym}' for #{Tori.config.backend.inspect}"
end
end
end
end