Class: Murdoc::Formatter
- Inherits:
-
Object
- Object
- Murdoc::Formatter
- Defined in:
- lib/murdoc/formatter.rb
Instance Attribute Summary collapse
-
#template ⇒ Object
Returns the value of attribute template.
Instance Method Summary collapse
-
#initialize(template_or_filename) ⇒ Formatter
constructor
A new instance of Formatter.
- #render(locals = {}) ⇒ Object
Constructor Details
#initialize(template_or_filename) ⇒ Formatter
Returns a new instance of Formatter.
7 8 9 10 11 12 13 |
# File 'lib/murdoc/formatter.rb', line 7 def initialize(template_or_filename) if File.exists?(template_or_filename) @template = File.read(template_or_filename) else @template = template_or_filename end end |
Instance Attribute Details
#template ⇒ Object
Returns the value of attribute template.
5 6 7 |
# File 'lib/murdoc/formatter.rb', line 5 def template @template end |
Instance Method Details
#render(locals = {}) ⇒ Object
15 16 17 |
# File 'lib/murdoc/formatter.rb', line 15 def render(locals = {}) ::Haml::Engine.new(template).render(self, locals) end |