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