Class: RShade::Formatter::Stack::String
- Defined in:
- lib/rshade/formatter/stack/string.rb
Direct Known Subclasses
Constant Summary collapse
- ROOT_SEP =
"---\n"
Instance Attribute Summary collapse
-
#colorize ⇒ Object
readonly
Returns the value of attribute colorize.
Instance Method Summary collapse
- #call(stack_frames, variable_serializer: nil) ⇒ Object
-
#initialize(colorize: true) ⇒ String
constructor
A new instance of String.
Constructor Details
#initialize(colorize: true) ⇒ String
11 12 13 |
# File 'lib/rshade/formatter/stack/string.rb', line 11 def initialize(colorize: true) @colorize = colorize end |
Instance Attribute Details
#colorize ⇒ Object (readonly)
Returns the value of attribute colorize.
7 8 9 |
# File 'lib/rshade/formatter/stack/string.rb', line 7 def colorize @colorize end |
Instance Method Details
#call(stack_frames, variable_serializer: nil) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/rshade/formatter/stack/string.rb', line 16 def call(stack_frames, variable_serializer: nil) buffer = StringIO.new stack_frames.each_with_index do |frame, idx| if idx.zero? buffer << ROOT_SEP next end next unless frame buffer.write line(idx, frame, idx) end buffer.string end |