Class: OodSupport::ACLEntry
- Inherits:
-
Object
- Object
- OodSupport::ACLEntry
- Includes:
- Comparable
- Defined in:
- lib/ood_support/acl_entry.rb
Overview
A helper object that defines a generic ACL entry
Direct Known Subclasses
Instance Attribute Summary collapse
-
#principle ⇒ String
readonly
The principle of this entry.
Class Method Summary collapse
-
.parse(entry, **kwargs) ⇒ ACLEntry
Generate an entry by parsing a string.
Instance Method Summary collapse
-
#<=>(other) ⇒ Boolean
The comparison operator.
-
#eql?(other) ⇒ Boolean
Checks whether two ACLEntry objects are completely identical to each other.
-
#hash ⇒ Integer
Generates a hash value for this object.
-
#initialize(principle:) ⇒ ACLEntry
constructor
A new instance of ACLEntry.
-
#is_allow? ⇒ Boolean
Is this an “allow” ACL entry.
-
#is_deny? ⇒ Boolean
Is this a “deny” ACL entry.
-
#match(principle:) ⇒ Boolean
Do the requested args match this ACL entry?.
-
#to_s ⇒ String
Convert object to string.
Constructor Details
#initialize(principle:) ⇒ ACLEntry
Returns a new instance of ACLEntry.
21 22 23 |
# File 'lib/ood_support/acl_entry.rb', line 21 def initialize(principle:) @principle = principle.to_s end |
Instance Attribute Details
#principle ⇒ String (readonly)
The principle of this entry
8 9 10 |
# File 'lib/ood_support/acl_entry.rb', line 8 def principle @principle end |
Class Method Details
.parse(entry, **kwargs) ⇒ ACLEntry
Generate an entry by parsing a string
15 16 17 18 |
# File 'lib/ood_support/acl_entry.rb', line 15 def self.parse(entry, **kwargs) args = parse_entry(entry).merge(kwargs) new(**args) end |
Instance Method Details
#<=>(other) ⇒ Boolean
The comparison operator
53 54 55 |
# File 'lib/ood_support/acl_entry.rb', line 53 def <=>(other) to_s <=> other end |
#eql?(other) ⇒ Boolean
Checks whether two ACLEntry objects are completely identical to each other
61 62 63 |
# File 'lib/ood_support/acl_entry.rb', line 61 def eql?(other) self.class == other.class && self == other end |
#hash ⇒ Integer
Generates a hash value for this object
67 68 69 |
# File 'lib/ood_support/acl_entry.rb', line 67 def hash [self.class, to_s].hash end |
#is_allow? ⇒ Boolean
Is this an “allow” ACL entry
27 28 29 |
# File 'lib/ood_support/acl_entry.rb', line 27 def is_allow? true end |
#is_deny? ⇒ Boolean
Is this a “deny” ACL entry
33 34 35 |
# File 'lib/ood_support/acl_entry.rb', line 33 def is_deny? !is_allow? end |
#match(principle:) ⇒ Boolean
Do the requested args match this ACL entry?
40 41 42 |
# File 'lib/ood_support/acl_entry.rb', line 40 def match(principle:) self.principle == principle end |
#to_s ⇒ String
Convert object to string
46 47 48 |
# File 'lib/ood_support/acl_entry.rb', line 46 def to_s principle end |