Class: Wongi::Engine::InequalityTest
- Inherits:
-
FilterTest
- Object
- FilterTest
- Wongi::Engine::InequalityTest
- Defined in:
- lib/wongi-engine/filter/inequality_test.rb
Instance Attribute Summary collapse
-
#x ⇒ Object
readonly
Returns the value of attribute x.
-
#y ⇒ Object
readonly
Returns the value of attribute y.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(x, y) ⇒ InequalityTest
constructor
A new instance of InequalityTest.
- #passes?(token) ⇒ Boolean
- #to_s ⇒ Object
Methods inherited from FilterTest
Constructor Details
#initialize(x, y) ⇒ InequalityTest
Returns a new instance of InequalityTest.
5 6 7 8 9 |
# File 'lib/wongi-engine/filter/inequality_test.rb', line 5 def initialize(x, y) super() @x = x @y = y end |
Instance Attribute Details
#x ⇒ Object (readonly)
Returns the value of attribute x.
3 4 5 |
# File 'lib/wongi-engine/filter/inequality_test.rb', line 3 def x @x end |
#y ⇒ Object (readonly)
Returns the value of attribute y.
3 4 5 |
# File 'lib/wongi-engine/filter/inequality_test.rb', line 3 def y @y end |
Instance Method Details
#==(other) ⇒ Object
29 30 31 |
# File 'lib/wongi-engine/filter/inequality_test.rb', line 29 def ==(other) self.class == other.class && x == other.x && y == other.y end |
#passes?(token) ⇒ Boolean
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/wongi-engine/filter/inequality_test.rb', line 11 def passes?(token) x = if Template.variable? @x token[@x] else @x end y = if Template.variable? @y token[@y] else @y end return false if x == :_ || y == :_ x != y end |
#to_s ⇒ Object
33 34 35 |
# File 'lib/wongi-engine/filter/inequality_test.rb', line 33 def to_s "#{x} != #{y}" end |