Module: ImmutableStructEx

Defined in:
lib/immutable_struct_ex.rb,
lib/immutable_struct_ex/version.rb,
lib/immutable_struct_ex/immutable.rb,
lib/immutable_struct_ex/comparable.rb

Overview

Defines the methods used to create/manage the ImmutableStructEx struct.

Defined Under Namespace

Modules: Comparable, Immutable

Constant Summary collapse

VERSION =
'1.0.11'

Class Method Summary collapse

Class Method Details

.new(**hash, &block) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/immutable_struct_ex.rb', line 10

def new(**hash, &block)
  Struct.new(*hash.keys, keyword_init: true, &block).tap do |struct|
    return struct.new(**hash).tap do |struct_object|
      struct_object.extend Comparable
      struct_object.extend Immutable
    end
  end
end