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
pivotal-erector-0.5.1 lib/erector/indenting.rb
pivotal-erector-0.6.0 lib/erector/indenting.rb
pivotal-erector-0.6.1 lib/erector/indenting.rb
pivotal-erector-0.6.2 lib/erector/indenting.rb
pivotal-erector-0.6.3 lib/erector/indenting.rb
pivotal-erector-0.6.4 lib/erector/indenting.rb
pivotal-erector-0.6.5 lib/erector/indenting.rb
pivotal-erector-0.6.6 lib/erector/indenting.rb
pivotal-erector-0.6.7 lib/erector/indenting.rb
pivotal-erector-0.7.0 lib/erector/indenting.rb
erector-0.10.0 lib/erector/erect/indenting.rb
erector-0.9.0 lib/erector/erect/indenting.rb
erector-0.9.0.pre1 lib/erector/erect/indenting.rb
erector-0.8.3 lib/erector/erect/indenting.rb
erector-0.8.2 lib/erector/erect/indenting.rb
honkster-erector-0.8.1 lib/erector/erect/indenting.rb
erector-0.8.1 lib/erector/erect/indenting.rb
erector-0.8.0 lib/erector/erect/indenting.rb
erector-0.7.2 lib/erector/indenting.rb
erector-0.7.1 lib/erector/indenting.rb