In Files

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.