Class: GhostWheel::Expression::Rule

Inherits:
GhostWheel::Expression show all
Defined in:
lib/ghost_wheel/expression/rule.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from GhostWheel::Expression

#parse

Constructor Details

#initialize(expression = nil) ⇒ Rule

Returns a new instance of Rule.



6
7
8
# File 'lib/ghost_wheel/expression/rule.rb', line 6

def initialize(expression = nil)
  @expression = expression
end

Instance Attribute Details

#expressionObject

Returns the value of attribute expression.



10
11
12
# File 'lib/ghost_wheel/expression/rule.rb', line 10

def expression
  @expression
end

Instance Method Details

#==(other) ⇒ Object



19
20
21
# File 'lib/ghost_wheel/expression/rule.rb', line 19

def ==(other)
  super and @expression == other.expression
end

#uncached_parse(scanner, cache) ⇒ Object



12
13
14
15
16
17
# File 'lib/ghost_wheel/expression/rule.rb', line 12

def uncached_parse(scanner, cache)
  if @expression.nil?
    raise EmptyRuleError, "You failed to set an expression for this rule."
  end
  @expression.parse(scanner, cache)
end