Class: BeforeActions::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/before_actions/command.rb

Instance Method Summary collapse

Constructor Details

#initialize(controller) ⇒ Command

Returns a new instance of Command.



4
5
6
# File 'lib/before_actions/command.rb', line 4

def initialize(controller)
  @controller = controller
end

Instance Method Details

#actions(*actions, &block) ⇒ Object



8
9
10
11
12
# File 'lib/before_actions/command.rb', line 8

def actions(*actions, &block)
  if actions.empty? || actions.map(&:to_s).include?(@controller.action_name)
    @controller.instance_eval(&block)
  end
end