Class: Navigable::ImmutableStruct

Inherits:
Struct
  • Object
show all
Defined in:
lib/navigable/immutable_struct.rb

Direct Known Subclasses

Result

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**args) ⇒ ImmutableStruct

Returns a new instance of ImmutableStruct.



11
12
13
14
15
# File 'lib/navigable/immutable_struct.rb', line 11

def initialize(**args)
  members.each { |key| args.fetch(key) }
  super(**args)
  freeze
end

Class Method Details

.new(*args, &block) ⇒ Object



6
7
8
# File 'lib/navigable/immutable_struct.rb', line 6

def new(*args, &block)
  super(*args, keyword_init: true, &block)
end