class Macros4Cuke::Formatter::ToTrace

A macro-step formatter that outputs in the given IO the formatting events. Can be useful in tracing the visit sequence inside a given macro-step collection.

Attributes

io[R]

The IO where the formatter's output will be written to.

Public Class Methods

new(anIO) click to toggle source
# File lib/macros4cuke/formatter/to-trace.rb, line 18
def initialize(anIO)
  @io = anIO
end

Public Instance Methods

implements() click to toggle source

Tell which notifications the formatter subscribes to.

# File lib/macros4cuke/formatter/to-trace.rb, line 23
def implements()
  return Formatter::AllNotifications
end
on_collection(aLevel, _) click to toggle source
# File lib/macros4cuke/formatter/to-trace.rb, line 27
def on_collection(aLevel, _)
  trace_event(aLevel, __method__)
end
on_collection_end(aLevel) click to toggle source
# File lib/macros4cuke/formatter/to-trace.rb, line 31
def on_collection_end(aLevel)
  trace_event(aLevel, __method__)
end
on_comment(aLevel, _) click to toggle source
# File lib/macros4cuke/formatter/to-trace.rb, line 63
def on_comment(aLevel, _)
  trace_event(aLevel, __method__)
end
on_eol(aLevel) click to toggle source
# File lib/macros4cuke/formatter/to-trace.rb, line 67
def on_eol(aLevel)
  trace_event(aLevel, __method__)
end
on_phrase(aLevel, _, _) click to toggle source
# File lib/macros4cuke/formatter/to-trace.rb, line 43
def on_phrase(aLevel, _, _)
  trace_event(aLevel, __method__)
end
on_placeholder(aLevel, _) click to toggle source
# File lib/macros4cuke/formatter/to-trace.rb, line 71
def on_placeholder(aLevel, _)
  trace_event(aLevel, __method__)
end
on_renderer(aLevel, _) click to toggle source
# File lib/macros4cuke/formatter/to-trace.rb, line 47
def on_renderer(aLevel, _)
  trace_event(aLevel, __method__)
end
on_renderer_end(aLevel) click to toggle source
# File lib/macros4cuke/formatter/to-trace.rb, line 51
def on_renderer_end(aLevel)
  trace_event(aLevel, __method__)
end
on_section(aLevel, _) click to toggle source
# File lib/macros4cuke/formatter/to-trace.rb, line 75
def on_section(aLevel, _)
  trace_event(aLevel, __method__)
end
on_section_end(aLevel) click to toggle source
# File lib/macros4cuke/formatter/to-trace.rb, line 79
def on_section_end(aLevel)
  trace_event(aLevel, __method__)
end
on_source(aLevel, _) click to toggle source
# File lib/macros4cuke/formatter/to-trace.rb, line 55
def on_source(aLevel, _)
  trace_event(aLevel, __method__)
end
on_static_text(aLevel, _) click to toggle source
# File lib/macros4cuke/formatter/to-trace.rb, line 59
def on_static_text(aLevel, _)
  trace_event(aLevel, __method__)
end
on_step(aLevel, _) click to toggle source
# File lib/macros4cuke/formatter/to-trace.rb, line 35
def on_step(aLevel, _)
  trace_event(aLevel, __method__)
end
on_step_end(aLevel) click to toggle source
# File lib/macros4cuke/formatter/to-trace.rb, line 39
def on_step_end(aLevel)
  trace_event(aLevel, __method__)
end

Private Instance Methods

indentation(aLevel) click to toggle source
# File lib/macros4cuke/formatter/to-trace.rb, line 85
def indentation(aLevel)
  return '  ' * aLevel
end
trace_event(aLevel, anEvent) click to toggle source
# File lib/macros4cuke/formatter/to-trace.rb, line 89
def trace_event(aLevel, anEvent)
  io.puts "#{indentation(aLevel)}#{anEvent}"
end