Class: HybridForest::Trees::Tests::Equal
- Defined in:
- lib/hybridforest/trees/tests/equal.rb
Instance Attribute Summary
Attributes inherited from Test
Instance Method Summary collapse
- #==(other) ⇒ Object
- #description ⇒ Object
- #eql?(other) ⇒ Boolean
-
#initialize(feature, value) ⇒ Equal
constructor
A new instance of Equal.
- #passed_by?(instance) ⇒ Boolean
- #to_s ⇒ Object
Methods inherited from Test
Constructor Details
#initialize(feature, value) ⇒ Equal
Returns a new instance of Equal.
9 10 11 |
# File 'lib/hybridforest/trees/tests/equal.rb', line 9 def initialize(feature, value) super(feature, value) end |
Instance Method Details
#==(other) ⇒ Object
17 18 19 20 |
# File 'lib/hybridforest/trees/tests/equal.rb', line 17 def ==(other) return false unless other.is_a? Equal feature == other.feature && value == other.value end |
#description ⇒ Object
31 32 33 |
# File 'lib/hybridforest/trees/tests/equal.rb', line 31 def description "#{feature} equal to #{value}?" end |
#eql?(other) ⇒ Boolean
22 23 24 25 |
# File 'lib/hybridforest/trees/tests/equal.rb', line 22 def eql?(other) return false unless other.is_a? Equal feature.eql?(other.feature) && value.eql?(other.value) end |
#passed_by?(instance) ⇒ Boolean
13 14 15 |
# File 'lib/hybridforest/trees/tests/equal.rb', line 13 def passed_by?(instance) instance[feature] == value end |
#to_s ⇒ Object
27 28 29 |
# File 'lib/hybridforest/trees/tests/equal.rb', line 27 def to_s "#{feature} == #{value}?" end |