Module: Mab::Mixin

### Home Classes Methods

### In Files

- lib/mab/mixin.rb

### Namespace

- MODULE Mab::Mixin::HTML5
- MODULE Mab::Mixin::HTMLDefiners
- MODULE Mab::Mixin::XHTML5
- MODULE Mab::Mixin::XML
- CLASS Mab::Mixin::Context
- CLASS Mab::Mixin::Error
- CLASS Mab::Mixin::Tag

### Methods

- #mab
- #mab_done
- #mab_insert
- #mab_options
- #mab_tag
- #tag!
- #text
- #text!

### 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::Mixin

### Public Instance Methods

mab(&blk) click to toggle source

    # File lib/mab/mixin.rb, line 170
    def mab(&blk)
      prev = defined?(@mab_context) && @mab_context
      ctx = @mab_context = Context.new
      res = instance_eval(&blk)
      ctx.empty? ? res : ctx.join
    ensure
      @mab_context = prev
    end

mab_done(tag) click to toggle source

    # File lib/mab/mixin.rb, line 184
    def mab_done(tag)
    end

mab_insert(tag) click to toggle source

    # File lib/mab/mixin.rb, line 179
    def mab_insert(tag)
      ctx = @mab_context || raise(Error, 'mab { }-block required')
      ctx << tag
    end

mab_options() click to toggle source

    # File lib/mab/mixin.rb, line 187
    def mab_options
      @mab_options ||= {}
    end

mab_tag(name) click to toggle source

    # File lib/mab/mixin.rb, line 151
    def mab_tag(name)
      ctx = @mab_context || raise(Error, "Tags can only be written within a `mab { }`-block")
      tag = Tag.new(name, mab_options, ctx, self)
      mab_insert(tag)
      tag
    end

tag!(name, *args, &blk) click to toggle source

    # File lib/mab/mixin.rb, line 158
    def tag!(name, *args, &blk)
      mab_tag(name)._insert(*args, &blk)
    end

text(str) click to toggle source

    # File lib/mab/mixin.rb, line 166
    def text(str)
      text! CGI.escapeHTML(str.to_s)
    end

text!(str) click to toggle source

    # File lib/mab/mixin.rb, line 162
    def text!(str)
      mab_insert(str)
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.