Class: Wongi::Engine::InequalityTest

Inherits:
FilterTest show all
Defined in:
lib/wongi-engine/beta/filter_node.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from FilterTest

#compile

Constructor Details

#initialize(x, y) ⇒ InequalityTest

Returns a new instance of InequalityTest.



60
61
62
# File 'lib/wongi-engine/beta/filter_node.rb', line 60

def initialize x, y
  @x, @y = x, y
end

Instance Attribute Details

#xObject (readonly)

Returns the value of attribute x.



58
59
60
# File 'lib/wongi-engine/beta/filter_node.rb', line 58

def x
  @x
end

#yObject (readonly)

Returns the value of attribute y.



58
59
60
# File 'lib/wongi-engine/beta/filter_node.rb', line 58

def y
  @y
end

Instance Method Details

#==(other) ⇒ Object



83
84
85
# File 'lib/wongi-engine/beta/filter_node.rb', line 83

def == other
  super && x == other.x && y == other.y
end

#passes?(token) ⇒ Boolean

Returns:

  • (Boolean)


64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/wongi-engine/beta/filter_node.rb', line 64

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 == :_
  return x != y

end