Class: Aequitas::ValueObject::Equalizer

Inherits:
Module
  • Object
show all
Defined in:
lib/aequitas/support/value_object.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(keys) ⇒ Equalizer

Returns a new instance of Equalizer.



35
36
37
# File 'lib/aequitas/support/value_object.rb', line 35

def initialize(keys)
  @keys = keys
end

Instance Attribute Details

#keysArray(Symbol) (readonly)

List of methods that will be used to compile #inspect,

#eql?, #== and #hash methods

Returns:

  • (Array(Symbol))


33
34
35
# File 'lib/aequitas/support/value_object.rb', line 33

def keys
  @keys
end

Instance Method Details

#compileself

Compile the equalizer methods based on #keys

Returns:

  • (self)


42
43
44
45
46
47
48
49
# File 'lib/aequitas/support/value_object.rb', line 42

def compile
  define_inspect_method
  define_eql_method
  define_equivalent_method
  define_hash_method

  self
end