Class: BeforeActions::Controller::Scope

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

Instance Method Summary collapse

Constructor Details

#initialize(controller, the_method_key) ⇒ Scope

Returns a new instance of Scope.



5
6
7
8
# File 'lib/before_actions/controller/scope.rb', line 5

def initialize(controller, the_method_key)
  @controller = controller
  @the_method_key = the_method_key
end

Instance Method Details

#all(&block) ⇒ Object



10
11
12
# File 'lib/before_actions/controller/scope.rb', line 10

def all(&block)
  @controller.send(the_method, &block)
end

#except(*list, &block) ⇒ Object



18
19
20
# File 'lib/before_actions/controller/scope.rb', line 18

def except(*list, &block)
  @controller.send(the_method, {except: list}, &block)
end

#only(*list, &block) ⇒ Object



14
15
16
# File 'lib/before_actions/controller/scope.rb', line 14

def only(*list, &block)
  @controller.send(the_method, {only: list}, &block)
end