Class: Steep::Drivers::TracePrinter
- Inherits:
-
Object
- Object
- Steep::Drivers::TracePrinter
- Defined in:
- lib/steep/drivers/trace_printer.rb
Instance Attribute Summary collapse
-
#io ⇒ Object
readonly
Returns the value of attribute io.
Instance Method Summary collapse
-
#initialize(io) ⇒ TracePrinter
constructor
A new instance of TracePrinter.
- #print(trace, level: 0) ⇒ Object
Constructor Details
#initialize(io) ⇒ TracePrinter
Returns a new instance of TracePrinter.
6 7 8 |
# File 'lib/steep/drivers/trace_printer.rb', line 6 def initialize(io) @io = io end |
Instance Attribute Details
#io ⇒ Object (readonly)
Returns the value of attribute io.
4 5 6 |
# File 'lib/steep/drivers/trace_printer.rb', line 4 def io @io end |
Instance Method Details
#print(trace, level: 0) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/steep/drivers/trace_printer.rb', line 10 def print(trace, level: 0) trace.each.with_index do |t, i| prefix = " " * (i + level) case t[0] when :type io.puts "#{prefix}#{t[1]} <: #{t[2]}" when :method io.puts "#{prefix}(#{t[3]}) #{t[1]} <: #{t[2]}" when :method_type io.puts "#{prefix}#{t[1]} <: #{t[2]}" end end end |