Module: SeeingIsBelieving::WrapExpressionsWithInspect

Defined in:
lib/seeing_is_believing/wrap_expressions_with_inspect.rb

Class Method Summary collapse

Class Method Details

.call(program) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/seeing_is_believing/wrap_expressions_with_inspect.rb', line 4

def self.call(program)
  # NOTE: if it received the AST, it could figure out if it needs
  # to always wrap the expression in parentheses
  WrapExpressions.call program,
    before_each: -> line_number {
      "$SiB.record_result(:inspect, #{line_number}, ("
    },
    after_each:  -> line_number {
      "))"
    }
end