lib/tori/define.rb in tori-0.0.8 vs lib/tori/define.rb in tori-0.0.9
- old
+ new
@@ -1,16 +1,16 @@
module Tori
module Define
- def tori(name)
+ def tori(name, &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))
+ ivar || instance_variable_set(name_ivar, File.new(self, &block))
end
define_method("#{name}=") do |uploader|
- file = File.new(self, from: uploader)
+ file = File.new(self, from: uploader, &block)
instance_variable_set name_ivar, file
end
end
end
end