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.
20 21 22 |
# File 'lib/ood_support/acl_entry.rb', line 20 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 |
# File 'lib/ood_support/acl_entry.rb', line 15 def self.parse(entry, **kwargs) new(parse_entry(entry).merge(kwargs)) end |
Instance Method Details
#<=>(other) ⇒ Boolean
The comparison operator
52 53 54 |
# File 'lib/ood_support/acl_entry.rb', line 52 def <=>(other) to_s <=> other end |
#eql?(other) ⇒ Boolean
Checks whether two ACLEntry objects are completely identical to each other
60 61 62 |
# File 'lib/ood_support/acl_entry.rb', line 60 def eql?(other) self.class == other.class && self == other end |
#hash ⇒ Integer
Generates a hash value for this object
66 67 68 |
# File 'lib/ood_support/acl_entry.rb', line 66 def hash [self.class, to_s].hash end |
#is_allow? ⇒ Boolean
Is this an “allow” ACL entry
26 27 28 |
# File 'lib/ood_support/acl_entry.rb', line 26 def is_allow? true end |
#is_deny? ⇒ Boolean
Is this a “deny” ACL entry
32 33 34 |
# File 'lib/ood_support/acl_entry.rb', line 32 def is_deny? !is_allow? end |
#match(principle:) ⇒ Boolean
Do the requested args match this ACL entry?
39 40 41 |
# File 'lib/ood_support/acl_entry.rb', line 39 def match(principle:) self.principle == principle end |
#to_s ⇒ String
Convert object to string
45 46 47 |
# File 'lib/ood_support/acl_entry.rb', line 45 def to_s principle end |