Module: Mab::Indentation

### Home Classes Methods

### In Files

- lib/mab/indentation.rb

### Methods

- #mab_done
- #mab_insert
- #reindent!

### Class/Module Index

Quicksearch

- Mab
- Mab::Builder
- Mab::Indentation
- Mab::Mixin
- Mab::Mixin::Context
- Mab::Mixin::Error
- Mab::Mixin::HTML5
- Mab::Mixin::HTMLDefiners
- Mab::Mixin::Tag
- Mab::Mixin::XHTML5
- Mab::Mixin::XML
- Mab::PrettyBuilder
- Mab::RailsBuilder
- Mab::RailsHandler
- Mab::SimpleBuilder
- Object

No matching classes.

# 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.