Mab::Indentation

Public Instance Methods

mab_done(tag) click to toggle source
# File lib/mab/indentation.rb, line 12
def mab_done(tag)
  if blk = tag._block
    tag._block = proc do
      begin
        @mab_context.options[:indentation] += 1
        blk.call
      ensure
        @mab_context.options[:indentation] -= 1
      end
    end
  end
  super
end
mab_insert(str) click to toggle source
# File lib/mab/indentation.rb, line 3
 def mab_insert(str)
  if i = @mab_context.options[:indentation]
    super([$/ + "  " * i, str])
  else
    @mab_context.options[:indentation] = 0
    super
  end
end
reindent!(str) click to toggle source
# File lib/mab/indentation.rb, line 26
def reindent!(str)
  str.split(/\r?\n/).each do |s|
    text! s
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.