Class: SweetActions::ActionFactory
- Inherits:
-
Object
- Object
- SweetActions::ActionFactory
- Defined in:
- lib/sweet_actions/action_factory.rb
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
-
#controller ⇒ Object
readonly
Returns the value of attribute controller.
-
#namespace ⇒ Object
readonly
Returns the value of attribute namespace.
-
#resource_name ⇒ Object
readonly
Returns the value of attribute resource_name.
Instance Method Summary collapse
- #build_action ⇒ Object
-
#initialize(controller, action_name) ⇒ ActionFactory
constructor
A new instance of ActionFactory.
Constructor Details
#initialize(controller, action_name) ⇒ ActionFactory
Returns a new instance of ActionFactory.
5 6 7 8 9 10 11 |
# File 'lib/sweet_actions/action_factory.rb', line 5 def initialize(controller, action_name) @controller = controller path_parameters = env['action_dispatch.request.path_parameters'] @resource_name = path_parameters[:resource_name] @action = action_name @namespace = path_parameters[:namespace] end |
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action.
3 4 5 |
# File 'lib/sweet_actions/action_factory.rb', line 3 def action @action end |
#controller ⇒ Object (readonly)
Returns the value of attribute controller.
3 4 5 |
# File 'lib/sweet_actions/action_factory.rb', line 3 def controller @controller end |
#namespace ⇒ Object (readonly)
Returns the value of attribute namespace.
3 4 5 |
# File 'lib/sweet_actions/action_factory.rb', line 3 def namespace @namespace end |
#resource_name ⇒ Object (readonly)
Returns the value of attribute resource_name.
3 4 5 |
# File 'lib/sweet_actions/action_factory.rb', line 3 def resource_name @resource_name end |
Instance Method Details
#build_action ⇒ Object
13 14 15 |
# File 'lib/sweet_actions/action_factory.rb', line 13 def build_action action_class.new(controller) end |