Sha256: 653764044e86a07072751267baabaab8632f635eebcd235756cf440e04de148c
Contents?: true
Size: 517 Bytes
Versions: 1
Compression:
Stored size: 517 Bytes
Contents
module Tori module Define def tori(name, id: :id) name_hash_get = "#{name}_hash".to_sym name_ivar = "@#{name}".to_sym name_hash_ivar = "@#{name}_hash".to_sym define_method(name) do instance_variable_get name_ivar end define_method("#{name}=") do |uploader| instance_variable_set name_ivar, uploader end define_method(name_hash_get) do Tori.config.hash_method.call "#{self.class.name}/#{__send__(id.to_sym)}" end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
tori-0.0.1 | lib/tori/define.rb |