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


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

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

#template_actionsObject


7
8
9
# File 'lib/pages_core/templates/controller_actions.rb', line 7

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

#template_actions_for(name) ⇒ Object


18
19
20
# File 'lib/pages_core/templates/controller_actions.rb', line 18

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