Class: Arrthorizer::Rails::ControllerAction
- Inherits:
-
Object
- Object
- Arrthorizer::Rails::ControllerAction
- Defined in:
- lib/arrthorizer/rails/controller_action.rb
Constant Summary collapse
- ControllerNotDefined =
Class.new(Arrthorizer::ArrthorizerException)
- ActionNotDefined =
Class.new(Arrthorizer::ArrthorizerException)
- ActionNotConfigured =
Class.new(Arrthorizer::ArrthorizerException)
Instance Attribute Summary collapse
-
#action_name ⇒ Object
readonly
Returns the value of attribute action_name.
-
#controller_path ⇒ Object
readonly
Returns the value of attribute controller_path.
-
#privilege ⇒ Object
Returns the value of attribute privilege.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(attrs) ⇒ ControllerAction
constructor
A new instance of ControllerAction.
- #to_key ⇒ Object
Constructor Details
#initialize(attrs) ⇒ ControllerAction
Returns a new instance of ControllerAction.
15 16 17 18 19 20 |
# File 'lib/arrthorizer/rails/controller_action.rb', line 15 def initialize(attrs) self.controller_path = attrs.fetch(:controller) { raise ControllerNotDefined } self.action_name = attrs.fetch(:action) { raise ActionNotDefined } self.class.register(self) end |
Instance Attribute Details
#action_name ⇒ Object
Returns the value of attribute action_name.
9 10 11 |
# File 'lib/arrthorizer/rails/controller_action.rb', line 9 def action_name @action_name end |
#controller_path ⇒ Object
Returns the value of attribute controller_path.
9 10 11 |
# File 'lib/arrthorizer/rails/controller_action.rb', line 9 def controller_path @controller_path end |
#privilege ⇒ Object
Returns the value of attribute privilege.
8 9 10 |
# File 'lib/arrthorizer/rails/controller_action.rb', line 8 def privilege @privilege end |
Class Method Details
.get_current(controller) ⇒ Object
11 12 13 |
# File 'lib/arrthorizer/rails/controller_action.rb', line 11 def self.get_current(controller) fetch(key_for(controller)) end |
Instance Method Details
#to_key ⇒ Object
22 23 24 |
# File 'lib/arrthorizer/rails/controller_action.rb', line 22 def to_key "#{controller_path}##{action_name}" end |