Class: RbacCore::Permission
- Inherits:
-
Object
- Object
- RbacCore::Permission
- Defined in:
- lib/rbac_core/permission.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#priority ⇒ Object
readonly
Returns the value of attribute priority.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #call(context) ⇒ Object
- #hash ⇒ Object
-
#initialize(name, priority: 0, **options, &block) ⇒ Permission
constructor
A new instance of Permission.
Constructor Details
#initialize(name, priority: 0, **options, &block) ⇒ Permission
Returns a new instance of Permission.
7 8 9 10 |
# File 'lib/rbac_core/permission.rb', line 7 def initialize(name, priority: 0, **, &block) @name = name @priority = priority end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/rbac_core/permission.rb', line 5 def name @name end |
#priority ⇒ Object (readonly)
Returns the value of attribute priority.
5 6 7 |
# File 'lib/rbac_core/permission.rb', line 5 def priority @priority end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
20 21 22 23 24 25 26 |
# File 'lib/rbac_core/permission.rb', line 20 def ==(other) unless other.is_a?(RbacCore::Permission) return false end instance_values == other.instance_values end |
#call(context) ⇒ Object
12 13 14 |
# File 'lib/rbac_core/permission.rb', line 12 def call(context, *) raise NotImplementedError end |
#hash ⇒ Object
16 17 18 |
# File 'lib/rbac_core/permission.rb', line 16 def hash instance_values.hash end |