Class: ImmutableStruct

Inherits:
Data
  • Object
show all
Defined in:
lib/esm/extension/immutable_struct.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name) ⇒ Object

Act like ostruct and return nil if the method isn't defined



8
9
10
# File 'lib/esm/extension/immutable_struct.rb', line 8

def method_missing(method_name, *, &)
  send(method_name, *, &) if self.class.method_defined?(method_name)
end

Instance Method Details

#respond_to_missing?(_method_name, _include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/esm/extension/immutable_struct.rb', line 12

def respond_to_missing?(_method_name, _include_private = false)
  true
end