lib/tori/define.rb in tori-0.4.1 vs lib/tori/define.rb in tori-0.5.0
- old
+ new
@@ -1,16 +1,16 @@
module Tori
module Define
- def tori(name, &block)
+ def tori(name, to: nil, &block)
name_ivar = "@#{name}".to_sym
define_method(name) do
ivar = instance_variable_get name_ivar
- ivar || instance_variable_set(name_ivar, File.new(self, title: name, &block))
+ ivar || instance_variable_set(name_ivar, File.new(self, title: name, to: to, &block))
end
define_method("#{name}=") do |uploader|
- file = File.new(self, title: name, from: uploader, &block)
+ file = File.new(self, title: name, from: uploader, to: to, &block)
instance_variable_set name_ivar, file
end
end
end
end