Class: HybridForest::Trees::Tests::NotEqual

Inherits:
Test
  • Object
show all
Defined in:
lib/hybridforest/trees/tests/not_equal.rb

Instance Attribute Summary

Attributes inherited from Test

#feature, #value

Instance Method Summary collapse

Methods inherited from Test

#hash

Constructor Details

#initialize(feature, value) ⇒ NotEqual

Returns a new instance of NotEqual.



9
10
11
# File 'lib/hybridforest/trees/tests/not_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/not_equal.rb', line 17

def ==(other)
  return false unless other.is_a? NotEqual
  feature == other.feature && value == other.value
end

#descriptionObject



31
32
33
# File 'lib/hybridforest/trees/tests/not_equal.rb', line 31

def description
  "#{feature} not equal to #{value}?"
end

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


22
23
24
25
# File 'lib/hybridforest/trees/tests/not_equal.rb', line 22

def eql?(other)
  return false unless other.is_a? NotEqual
  feature.eql?(other.feature) && value.eql?(other.value)
end

#passed_by?(instance) ⇒ Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/hybridforest/trees/tests/not_equal.rb', line 13

def passed_by?(instance)
  instance[feature] != value
end

#to_sObject



27
28
29
# File 'lib/hybridforest/trees/tests/not_equal.rb', line 27

def to_s
  "#{feature} != #{value}?"
end