Class: CanTango::PermissionEngine::Parser::Rule
- Inherits:
-
Object
- Object
- CanTango::PermissionEngine::Parser::Rule
- Defined in:
- lib/cantango/permission_engine/parser/rule.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
-
#method ⇒ Object
readonly
Returns the value of attribute method.
-
#model ⇒ Object
readonly
Returns the value of attribute model.
-
#target ⇒ Object
readonly
Returns the value of attribute target.
Instance Method Summary collapse
-
#initialize(method, action, target) ⇒ Rule
constructor
A new instance of Rule.
- #parse ⇒ Object
- #parse_class(target = nil) ⇒ Object
- #try_class ⇒ Object
Constructor Details
#initialize(method, action, target) ⇒ Rule
Returns a new instance of Rule.
8 9 10 11 12 |
# File 'lib/cantango/permission_engine/parser/rule.rb', line 8 def initialize method, action, target @target = target @method = method @action = action end |
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action.
6 7 8 |
# File 'lib/cantango/permission_engine/parser/rule.rb', line 6 def action @action end |
#method ⇒ Object (readonly)
Returns the value of attribute method.
6 7 8 |
# File 'lib/cantango/permission_engine/parser/rule.rb', line 6 def method @method end |
#model ⇒ Object (readonly)
Returns the value of attribute model.
6 7 8 |
# File 'lib/cantango/permission_engine/parser/rule.rb', line 6 def model @model end |
#target ⇒ Object (readonly)
Returns the value of attribute target.
6 7 8 |
# File 'lib/cantango/permission_engine/parser/rule.rb', line 6 def target @target end |
Instance Method Details
#parse ⇒ Object
14 15 |
# File 'lib/cantango/permission_engine/parser/rule.rb', line 14 def parse end |
#parse_class(target = nil) ⇒ Object
17 18 19 20 |
# File 'lib/cantango/permission_engine/parser/rule.rb', line 17 def parse_class target = nil @target = target if target try_class.to_s end |
#try_class ⇒ Object
22 23 24 25 26 |
# File 'lib/cantango/permission_engine/parser/rule.rb', line 22 def try_class target.constantize rescue raise "[permission] target #{target} does not have a class so it was skipped" end |