Class: GhostWheel::Expression::Transform
- Inherits:
-
GhostWheel::Expression
- Object
- GhostWheel::Expression
- GhostWheel::Expression::Transform
- Defined in:
- lib/ghost_wheel/expression/transform.rb
Instance Attribute Summary collapse
-
#expression ⇒ Object
readonly
Returns the value of attribute expression.
-
#transformer ⇒ Object
readonly
Returns the value of attribute transformer.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(expression, &transformer) ⇒ Transform
constructor
A new instance of Transform.
- #uncached_parse(scanner, cache) ⇒ Object
Methods inherited from GhostWheel::Expression
Constructor Details
#initialize(expression, &transformer) ⇒ Transform
Returns a new instance of Transform.
6 7 8 9 |
# File 'lib/ghost_wheel/expression/transform.rb', line 6 def initialize(expression, &transformer) @expression = expression @transformer = transformer end |
Instance Attribute Details
#expression ⇒ Object (readonly)
Returns the value of attribute expression.
11 12 13 |
# File 'lib/ghost_wheel/expression/transform.rb', line 11 def expression @expression end |
#transformer ⇒ Object (readonly)
Returns the value of attribute transformer.
11 12 13 |
# File 'lib/ghost_wheel/expression/transform.rb', line 11 def transformer @transformer end |
Instance Method Details
#==(other) ⇒ Object
23 24 25 26 27 |
# File 'lib/ghost_wheel/expression/transform.rb', line 23 def ==(other) super and @expression == other.expression and @transformer == other.transformer end |
#uncached_parse(scanner, cache) ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/ghost_wheel/expression/transform.rb', line 13 def uncached_parse(scanner, cache) result = @expression.parse(scanner, cache) if result.is_a? FailedParseResult result else value = result.is_a?(ParseResult) ? result.value : result ParseResult.new(@transformer[value]) end end |