Module: NRSER::Props::Immutable::Hash

Included in:
I8::Struct::Hash
Defined in:
lib/nrser/props/immutable/hash.rb

Overview

Mixin for classes that extend Hamster::Hash and will use itself as the property value storage.

Defined Under Namespace

Modules: ClassMethods, InstanceMethods

Constant Summary collapse

STORAGE =

Constants

NRSER::Props::Storage::Key.new immutable: true, key_type: :name

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object

Module Methods



39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/nrser/props/immutable/hash.rb', line 39

def self.included base
  unless base < Hamster::Hash
    raise binding.erb <<~END
      This class is only for including in {Hamster::Hash} subclasses!
    END
  end
  
  base.include NRSER::Props
  base..storage STORAGE
  base..freeze
  
  base.extend ClassMethods
  base.include InstanceMethods
end