Class: Malt::Format::Builder

Inherits:
Abstract show all
Defined in:
lib/malt/formats/builder.rb

Overview

Builder looks like a Markup format, but it is a template format as Ruby code.

http://builder.rubyforge.org/

Instance Attribute Summary

Attributes inherited from Abstract

#options

Instance Method Summary collapse

Methods inherited from Abstract

#default, #engine, engine, extensions, #extensions, #file, #parse_type_and_data, #refile, register, #render, #subtype, #text, #to, #to_default, #to_s, #type

Instance Method Details

#builderObject



17
18
19
# File 'lib/malt/formats/builder.rb', line 17

def builder(*)
  text
end

#html(data = nil, &yld) ⇒ Object



27
28
29
# File 'lib/malt/formats/builder.rb', line 27

def html(data=nil, &yld)
  render_engine.render(:format=>:html, :text=>text, :file=>file, :data=>data, &yld)
end

#to_builderObject



22
23
24
# File 'lib/malt/formats/builder.rb', line 22

def to_builder(*)
  self
end

#to_html(data = nil, &yld) ⇒ Object



32
33
34
35
36
# File 'lib/malt/formats/builder.rb', line 32

def to_html(data=nil, &yld)
  text = html(data, &yld)
  opts = options.merge(:text=>text, :file=>refile(:html), :type=>:html)
  HTML.new(opts)
end