Module: FiniteMDP::VectorValued
- Defined in:
- lib/finite_mdp/vector_valued.rb
Overview
Define an object's hash code and equality (in the sense of eql?
) according to its array representation (to_a
). See notes for Model for why this might be useful.
A class that includes this module must define to_a
.
Instance Method Summary collapse
-
#eql?(other) ⇒ Boolean
Redefine equality based on
to_a
. -
#hash ⇒ Integer
Redefine hashing based on
to_a
.
Instance Method Details
#eql?(other) ⇒ Boolean
Redefine equality based on to_a
.
44 45 46 |
# File 'lib/finite_mdp/vector_valued.rb', line 44 def eql?(other) to_a.eql? other.to_a end |
#hash ⇒ Integer
Redefine hashing based on to_a
.
35 36 37 |
# File 'lib/finite_mdp/vector_valued.rb', line 35 def hash to_a.hash end |