Class: Mutant::Expression::Parser Private
- Inherits:
-
Object
- Object
- Mutant::Expression::Parser
- Defined in:
- lib/mutant/expression/parser.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Defined Under Namespace
Classes: AmbiguousExpressionError, InvalidExpressionError, ParserError
Instance Method Summary collapse
-
#call(input) ⇒ Expression
private
Parse input into expression or raise.
-
#try_parse(input) ⇒ Expression?
private
Try to parse input into expression.
Instance Method Details
#call(input) ⇒ Expression
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Parse input into expression or raise
25 26 27 |
# File 'lib/mutant/expression/parser.rb', line 25 def call(input) try_parse(input) or fail InvalidExpressionError, "Expression: #{input.inspect} is not valid" end |
#try_parse(input) ⇒ Expression?
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Try to parse input into expression
38 39 40 41 42 43 44 45 46 |
# File 'lib/mutant/expression/parser.rb', line 38 def try_parse(input) expressions = expressions(input) case expressions.length when 0, 1 expressions.first else fail AmbiguousExpressionError, "Ambiguous expression: #{input.inspect}" end end |