Sha256: 70ef56f181c79a1217c4207b7f9abaae0455064e099678729c45915dd01aaf6a
Contents?: true
Size: 452 Bytes
Versions: 2
Compression:
Stored size: 452 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, title: name, &block)) end define_method("#{name}=") do |uploader| file = File.new(self, title: name, from: uploader, &block) instance_variable_set name_ivar, file end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
tori-0.4.1 | lib/tori/define.rb |
tori-0.4.0 | lib/tori/define.rb |