Module: Templatable::ClassMethods

Defined in:
lib/templatable.rb

Instance Method Summary collapse

Instance Method Details

#template(template) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/templatable.rb', line 9

def template(template)
  define_method :get_template do
    template
  end

  define_method :get_placeholders do
    ret = template.scan /<%=placeholders\[:(.*)\]%>/
    ret_hash = {}
    ret.each { |v| ret_hash[v.first.to_sym] = v.first }
    ret_hash
  end
end