Module: PagesCore::Templates::ControllerActions::ClassMethods

Defined in:
lib/pages_core/templates/controller_actions.rb

Instance Method Summary collapse

Instance Method Details

#template(*names, &block) ⇒ Object



13
14
15
16
17
18
# File 'lib/pages_core/templates/controller_actions.rb', line 13

def template(*names, &block)
  Array(names).each do |name|
    name = name.to_s unless name == :all
    template_actions[name] << block
  end
end

#template_actionsObject



9
10
11
# File 'lib/pages_core/templates/controller_actions.rb', line 9

def template_actions
  @template_actions ||= Hash.new { |hash, key| hash[key] = [] }
end

#template_actions_for(name) ⇒ Object



20
21
22
# File 'lib/pages_core/templates/controller_actions.rb', line 20

def template_actions_for(name)
  template_actions[:all] + template_actions[name.to_s]
end