Class: Tarquinn::Controller Private
- Inherits:
-
Object
- Object
- Tarquinn::Controller
- Defined in:
- lib/tarquinn/controller.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Controller interface
Instance Method Summary collapse
-
#call(method, *args, **opts, &block) ⇒ Object
private
Calls a method from the controller.
-
#initialize(controller) ⇒ Controller
constructor
private
A new instance of Controller.
-
#method?(method) ⇒ TrueClass, FalseClass
private
Checks if the controller responds to a method.
-
#params ⇒ ActionController::Parameters
private
Returns request parameters.
-
#run(&block) ⇒ Object
private
Run a block in teh context of the controller.
Constructor Details
#initialize(controller) ⇒ Controller
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Controller.
8 9 10 |
# File 'lib/tarquinn/controller.rb', line 8 def initialize(controller) @controller = controller end |
Instance Method Details
#call(method, *args, **opts, &block) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Calls a method from the controller
27 28 29 |
# File 'lib/tarquinn/controller.rb', line 27 def call(method, *args, **opts, &block) controller.send(method, *args, **opts, &block) end |
#method?(method) ⇒ TrueClass, FalseClass
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Checks if the controller responds to a method
46 47 48 |
# File 'lib/tarquinn/controller.rb', line 46 def method?(method) controller.respond_to?(method, true) end |
#params ⇒ ActionController::Parameters
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns request parameters
15 16 17 |
# File 'lib/tarquinn/controller.rb', line 15 def params @params ||= controller.send(:params) end |
#run(&block) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Run a block in teh context of the controller
36 37 38 |
# File 'lib/tarquinn/controller.rb', line 36 def run(&block) controller.send(:instance_eval, &block) end |