Class: SeeingIsBelieving::ExpressionList
- Inherits:
-
Object
- Object
- SeeingIsBelieving::ExpressionList
- Defined in:
- lib/seeing_is_believing/expression_list.rb
Defined Under Namespace
Classes: PendingExpression
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(options) ⇒ ExpressionList
constructor
A new instance of ExpressionList.
Constructor Details
#initialize(options) ⇒ ExpressionList
Returns a new instance of ExpressionList.
18 19 20 21 22 23 |
# File 'lib/seeing_is_believing/expression_list.rb', line 18 def initialize() self.debugger = .fetch :debugger, Debugger.new(enabled: false) self.get_next_line = .fetch :get_next_line self.peek_next_line = .fetch :peek_next_line self.on_complete = .fetch :on_complete end |
Instance Method Details
#call ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/seeing_is_believing/expression_list.rb', line 25 def call offset, expressions, expression = 0, [], nil begin pending_expression = generate(expressions) debugger.context debugger_context do "GENERATED: #{pending_expression.expression.inspect}, ADDING IT TO #{inspected_expressions expressions}" end expression = reduce expressions, offset unless next_line_modifies_current? offset += 1 end until expressions.empty? return expression, offset end |