Module: ActionTree::Components::Tilt::NodeMethods

Defined in:
lib/action_tree/components/tilt.rb

Instance Method Summary collapse

Instance Method Details

#template(*args) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/action_tree/components/tilt.rb', line 13

def template(*args)
  tilt    = args.find {|a| a.is_a?(Tilt::Template) }
  name    = args.find {|a| a.is_a?(Symbol) }
  source  = args.find {|a| a.is_a?(String) }
  options = args.find {|a| a.is_a?(Hash) }

  unless tilt
    path = File.join(@conf[:template_path], source)
    tilt = Tilt.new(path, nil, options)
  end
  templates[name] = tilt
end

#templatesObject



9
10
11
# File 'lib/action_tree/components/tilt.rb', line 9

def templates
  @templates ||= {}
end