Class: CanTango::PermissionEngine::Statement
- Inherits:
-
Object
- Object
- CanTango::PermissionEngine::Statement
- Defined in:
- lib/cantango/permission_engine/statement.rb
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
-
#conditions ⇒ Object
readonly
Returns the value of attribute conditions.
-
#method ⇒ Object
readonly
Returns the value of attribute method.
Instance Method Summary collapse
-
#initialize(method, action, conditions = {}) ⇒ Statement
constructor
A new instance of Statement.
- #to_code ⇒ Object
Constructor Details
#initialize(method, action, conditions = {}) ⇒ Statement
Returns a new instance of Statement.
6 7 8 |
# File 'lib/cantango/permission_engine/statement.rb', line 6 def initialize method, action, conditions = {} @method, @action, @conditions = [method, action, conditions] end |
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action.
4 5 6 |
# File 'lib/cantango/permission_engine/statement.rb', line 4 def action @action end |
#conditions ⇒ Object (readonly)
Returns the value of attribute conditions.
4 5 6 |
# File 'lib/cantango/permission_engine/statement.rb', line 4 def conditions @conditions end |
#method ⇒ Object (readonly)
Returns the value of attribute method.
4 5 6 |
# File 'lib/cantango/permission_engine/statement.rb', line 4 def method @method end |
Instance Method Details
#to_code ⇒ Object
10 11 12 |
# File 'lib/cantango/permission_engine/statement.rb', line 10 def to_code line = conditions.empty? ? "#{method}(:#{action})" : "#{method}(:#{action}, #{conditions})" end |