Module IO::ImplIndent
In: lib/ttk/Tools/io/ext.rb
lib/ttk/Tools/io/delegator.rb

Methods

indent   indent  

Public Instance methods

[Source]

# File lib/ttk/Tools/io/ext.rb, line 11
    def indent(x='  ', &block)
      old = "#@indent"
#      p "old: `#@indent'"
      @indent += x.is_a?(Numeric) ? '  ' * x : x.to_s
#      p "ind: `#@indent'"
      yield(self)
      @indent = old
    end

[Source]

# File lib/ttk/Tools/io/delegator.rb, line 63
    def indent(x=nil, &block)
      lvl = (x and x.is_a?(Numeric)) ? '  ' * x : x.to_s
      l = IO::OutputFIlter.new(self) { |x| lvl + x.gsub!(/\n/, "\n#{lvl}") }
      block[l]
    end

[Validate]