Sha256: afc2b3ba77ec9217869546b12bfa9a863b1b6e1e2fe524e27f51fa31a5249623
Contents?: true
Size: 727 Bytes
Versions: 3
Compression:
Stored size: 727 Bytes
Contents
module InheritableAccessors module InheritableHashAccessor extend ActiveSupport::Concern module ClassMethods def inheritable_hash_accessor(name) name = name.to_s module_eval <<-METHODS def self.inheritable_hash? true end def self.#{name} @__#{name}__ ||= begin if superclass.respond_to?(:inheritable_hash?) superclass.#{name}.inherit_copy else ::InheritableAccessors::InheritableHash.new end end end def #{name} @__#{name}__ ||= self.class.#{name}.inherit_copy end METHODS end end end end
Version data entries
3 entries across 3 versions & 1 rubygems