Class: Mutant::Expression::Parser Private

Inherits:
Object
  • Object
show all
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.

Instance Method Summary collapse

Instance Method Details

#apply(input) ⇒ Either<String, 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.

Apply expression parsing



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/mutant/expression/parser.rb', line 17

def apply(input)
  expressions = expressions(input)
  case expressions.length
  when 0
    Either::Left.new("Expression: #{input.inspect} is invalid")
  when 1
    Either::Right.new(expressions.first)
  else
    Either::Left.new("Expression: #{input.inspect} is ambiguous")
  end
end