lib/macros4cuke/formatter/to-trace.rb in macros4cuke-0.4.00 vs lib/macros4cuke/formatter/to-trace.rb in macros4cuke-0.4.01
- old
+ new
@@ -11,17 +11,18 @@
# Can be useful in tracing the visit sequence inside
# a given macro-step collection.
class ToTrace
# The IO where the formatter's output will be written to.
attr_reader(:io)
-
+
def initialize(anIO)
@io = anIO
end
public
+
# Tell which notifications the formatter subscribes to.
def implements()
return Formatter::AllNotifications
end
@@ -58,11 +59,11 @@
end
def on_static_text(aLevel, aStaticText)
trace_event(aLevel, __method__)
end
-
+
def on_comment(aLevel, aComment)
trace_event(aLevel, __method__)
end
def on_eol(aLevel)
@@ -80,13 +81,14 @@
def on_section_end(aLevel)
trace_event(aLevel, __method__)
end
private
+
def indentation(aLevel)
return ' ' * aLevel
end
-
+
def trace_event(aLevel, anEvent)
io.puts "#{indentation(aLevel)}#{anEvent}"
end