Module: Aequitas::ValueObject

Included in:
ContextualRuleSet, Rule, Rule::Guard, Rule::SkipCondition, RuleSet, Violation
Defined in:
lib/aequitas/support/value_object.rb

Defined Under Namespace

Classes: Equalizer

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#equalizerObject (readonly)

An Equalizer module which defines #inspect, #eql?, #== and #hash for instances of this class



8
9
10
# File 'lib/aequitas/support/value_object.rb', line 8

def equalizer
  @equalizer
end

Instance Method Details

#equalize_on(*keys) ⇒ self

Define and include a module that provides Value Object semantics for

this class. Included module will have #inspect, #eql?, #== and #hash
methods whose definition is based on the _keys_ argument

Parameters:

  • keys (Array(Symbol))

    List of keys that will be used to define #inspect, #eql?, #==, and #hash

Returns:

  • (self)


20
21
22
23
24
25
26
# File 'lib/aequitas/support/value_object.rb', line 20

def equalize_on(*keys)
  @equalizer = Equalizer.new(keys)
  @equalizer.compile
  include @equalizer

  self
end