class XcodeResultBundleProcessor::IndentedStringBuffer
Public Class Methods
new(buffer=nil, indent_level=0)
click to toggle source
# File lib/xcoderesultbundleprocessor/indented_string_buffer.rb, line 3 def initialize(buffer=nil, indent_level=0) @buffer = buffer || '' @indent_spaces = 2 @indent_level = indent_level end
Public Instance Methods
<<(arg)
click to toggle source
# File lib/xcoderesultbundleprocessor/indented_string_buffer.rb, line 9 def <<(arg) Array(arg).each do |line| @buffer << ' ' * (@indent_spaces * @indent_level) << line @buffer << "\n" unless line.end_with?("\n") @buffer end self end
add_newline()
click to toggle source
# File lib/xcoderesultbundleprocessor/indented_string_buffer.rb, line 18 def add_newline @buffer << "\n" self end
indent()
click to toggle source
# File lib/xcoderesultbundleprocessor/indented_string_buffer.rb, line 23 def indent IndentedStringBuffer.new(@buffer, @indent_level + 1) end
to_s()
click to toggle source
# File lib/xcoderesultbundleprocessor/indented_string_buffer.rb, line 27 def to_s return "\n" if @buffer.empty? @buffer end