Class: RoleCore::Permission
- Inherits:
-
Object
- Object
- RoleCore::Permission
- Defined in:
- lib/role_core/permission.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#callable ⇒ Object
readonly
Returns the value of attribute callable.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#namespace ⇒ Object
readonly
Returns the value of attribute namespace.
-
#priority ⇒ Object
readonly
Returns the value of attribute priority.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #call(context) ⇒ Object
- #hash ⇒ Object
-
#initialize(name, _namespace: [], _priority: 0, _callable: false, **options, &block) ⇒ Permission
constructor
A new instance of Permission.
Constructor Details
#initialize(name, _namespace: [], _priority: 0, _callable: false, **options, &block) ⇒ Permission
Returns a new instance of Permission.
7 8 9 10 11 12 |
# File 'lib/role_core/permission.rb', line 7 def initialize(name, _namespace: [], _priority: 0, _callable: false, **, &block) @name = name @namespace = _namespace @priority = _priority @callable = _callable end |
Instance Attribute Details
#callable ⇒ Object (readonly)
Returns the value of attribute callable.
5 6 7 |
# File 'lib/role_core/permission.rb', line 5 def callable @callable end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/role_core/permission.rb', line 5 def name @name end |
#namespace ⇒ Object (readonly)
Returns the value of attribute namespace.
5 6 7 |
# File 'lib/role_core/permission.rb', line 5 def namespace @namespace end |
#priority ⇒ Object (readonly)
Returns the value of attribute priority.
5 6 7 |
# File 'lib/role_core/permission.rb', line 5 def priority @priority end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
22 23 24 25 26 27 28 |
# File 'lib/role_core/permission.rb', line 22 def ==(other) unless other.is_a?(RoleCore::Permission) return false end instance_values == other.instance_values end |
#call(context) ⇒ Object
14 15 16 |
# File 'lib/role_core/permission.rb', line 14 def call(context, *) raise NotImplementedError end |
#hash ⇒ Object
18 19 20 |
# File 'lib/role_core/permission.rb', line 18 def hash instance_values.hash end |