Sha256: 1dbccda3e634b0506a58ff72bf7af1c1bb9a29343d695762bdb4d058726773c1
Contents?: true
Size: 477 Bytes
Versions: 12
Compression:
Stored size: 477 Bytes
Contents
module Tori module Define 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, to: to, &block)) end define_method("#{name}=") do |uploader| file = File.new(self, title: name, from: uploader, to: to, &block) instance_variable_set name_ivar, file end end end end
Version data entries
12 entries across 12 versions & 1 rubygems