Class: Malt::Formats::Haml

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

Overview

Haml looks like a Markup format, but it turns out to be a template format too.

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_s, #type

Instance Method Details

#hamlObject



14
15
16
# File 'lib/malt/formats/haml.rb', line 14

def haml
  text
end

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



24
25
26
# File 'lib/malt/formats/haml.rb', line 24

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

#to_hamlObject



19
20
21
# File 'lib/malt/formats/haml.rb', line 19

def to_haml
  self
end

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



29
30
31
32
33
# File 'lib/malt/formats/haml.rb', line 29

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