Sha256: a101e568cb8f3f189d167e73ed3ccf41692b889fc7d3820092a8cee62f18e9cb

Contents?: true

Size: 495 Bytes

Versions: 31

Compression:

Stored size: 495 Bytes

Contents

require 'rubygems'
require 'treetop'

module Erector
  class Indenting < Treetop::Runtime::SyntaxNode #:nodoc:
    @@indent = 0

    def set_indent(x)
      @@indent = x
      self
    end

    def indent
      [0, @@indent].max
    end

    def indented(s)
      "  " * indent + s + "\n"
    end

    def line(s)
      indented(s)
    end

    def line_in(s)
      s = indented(s)
      @@indent += 1
      s
    end

    def line_out(s)
      @@indent -= 1
      indented(s)
    end
  end
end

Version data entries

31 entries across 31 versions & 3 rubygems

Version Path
erector-0.7.0 lib/erector/indenting.rb
erector-0.6.7 lib/erector/indenting.rb
erector-0.3.105 lib/erector/indenting.rb
erector-0.3.110 lib/erector/indenting.rb
erector-0.6.4 lib/erector/indenting.rb
erector-0.5.0 lib/erector/indenting.rb
erector-0.6.6 lib/erector/indenting.rb
erector-0.6.3 lib/erector/indenting.rb
erector-0.4.191 lib/erector/indenting.rb
erector-0.5.1 lib/erector/indenting.rb
erector-0.4.200 lib/erector/indenting.rb