lib/tori/define.rb in tori-0.0.3 vs lib/tori/define.rb in tori-0.0.4

- old
+ new

@@ -1,17 +1,17 @@ module Tori module Define def tori(name) - name_file_ivar = "@#{name}_file".to_sym + name_ivar = "@#{name}".to_sym define_method(name) do - ivar = instance_variable_get name_file_ivar - instance_variable_set name_file_ivar, ivar || File.new(self) + ivar = instance_variable_get name_ivar + instance_variable_set name_ivar, ivar || File.new(self) end define_method("#{name}=") do |uploader| - file = File.new(self, uploader) - instance_variable_set name_file_ivar, file + file = File.new(self, from: uploader) + instance_variable_set name_ivar, file end end end end