Class: ActiveRecordDoctor::Logger::Hierarchical
- Inherits:
-
Object
- Object
- ActiveRecordDoctor::Logger::Hierarchical
- Defined in:
- lib/active_record_doctor/logger/hierarchical.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#initialize(io) ⇒ Hierarchical
constructor
A new instance of Hierarchical.
- #log(message) ⇒ Object
Constructor Details
#initialize(io) ⇒ Hierarchical
Returns a new instance of Hierarchical.
6 7 8 9 |
# File 'lib/active_record_doctor/logger/hierarchical.rb', line 6 def initialize(io) @io = io @nesting = 0 end |
Instance Method Details
#log(message) ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/active_record_doctor/logger/hierarchical.rb', line 11 def log() @io.puts((" " * @nesting) + .to_s) return if !block_given? @nesting += 1 result = yield @nesting -= 1 result end |