Class: HamlUserTags::Engine

Inherits:
Haml::Engine
  • Object
show all
Defined in:
lib/haml_user_tags/engine.rb

Instance Method Summary collapse

Constructor Details

#initialize(template, options = {}) ⇒ Engine

Returns a new instance of Engine.



3
4
5
6
# File 'lib/haml_user_tags/engine.rb', line 3

def initialize(template, options = {})
  options = options.clone.update(:compiler_class => HamlUserTags::Compiler)
  super template, options
end

Instance Method Details

#extend_object(obj) ⇒ Object

Defines a method for each user tag in the template that renders the tag and returns the result as a string.



10
11
12
13
14
15
16
# File 'lib/haml_user_tags/engine.rb', line 10

def extend_object obj
  mod = Module.new
  mod.send :include, Haml::Helpers
  render mod
  method = obj.is_a?(Module) ? :include : :extend
  obj.send method, mod
end