Sha256: 4b50c93880cdf628239294263d5a83389a58228ff81c1f4b3515f2f408394657
Contents?: true
Size: 426 Bytes
Versions: 4
Compression:
Stored size: 426 Bytes
Contents
module Tori module Define 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, &block)) end define_method("#{name}=") do |uploader| file = File.new(self, from: uploader, &block) instance_variable_set name_ivar, file end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
tori-0.3.0 | lib/tori/define.rb |
tori-0.2.0 | lib/tori/define.rb |
tori-0.1.0 | lib/tori/define.rb |
tori-0.0.9 | lib/tori/define.rb |