Class: Wongi::Engine::EqualityTest

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) ⇒ EqualityTest

Returns a new instance of EqualityTest.



27
28
29
# File 'lib/wongi-engine/beta/filter_node.rb', line 27

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

Instance Attribute Details

#xObject (readonly)

Returns the value of attribute x.



25
26
27
# File 'lib/wongi-engine/beta/filter_node.rb', line 25

def x
  @x
end

#yObject (readonly)

Returns the value of attribute y.



25
26
27
# File 'lib/wongi-engine/beta/filter_node.rb', line 25

def y
  @y
end

Instance Method Details

#==(other) ⇒ Object



50
51
52
# File 'lib/wongi-engine/beta/filter_node.rb', line 50

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

#passes?(token) ⇒ Boolean

Returns:

  • (Boolean)


31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/wongi-engine/beta/filter_node.rb', line 31

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