class OodSupport::ACLEntry
A helper object that defines a generic ACL
entry
Attributes
The principle of this entry @return [String] principle of entry
Public Class Methods
@param principle [#to_s] principle for this ACL
entry
# File lib/ood_support/acl_entry.rb, line 20 def initialize(principle:) @principle = principle.to_s end
Generate an entry by parsing a string @param entry [#to_s] string describing entry @param kwargs [Hash] extra arguments @raise [InvalidACLEntry] unable to parse entry string @return [ACLEntry] entry generated by string
# File lib/ood_support/acl_entry.rb, line 15 def self.parse(entry, **kwargs) new(parse_entry(entry).merge(kwargs)) end
Private Class Methods
Parse an entry string into input parameters
# File lib/ood_support/acl_entry.rb, line 72 def self.parse_entry(entry) { principle: entry.to_s.strip } end
Public Instance Methods
The comparison operator @param other [#to_s] entry to compare against @return [Boolean] how entries compare
# File lib/ood_support/acl_entry.rb, line 52 def <=>(other) to_s <=> other end
Checks whether two ACLEntry
objects are completely identical to each other @param other [ACLEntry] entry to compare against @return [Boolean] whether same objects
# File lib/ood_support/acl_entry.rb, line 60 def eql?(other) self.class == other.class && self == other end
Generates a hash value for this object @return [Integer] hash value of object
# File lib/ood_support/acl_entry.rb, line 66 def hash [self.class, to_s].hash end
Is this an “allow” ACL
entry @return [Boolean] is this an allow entry
# File lib/ood_support/acl_entry.rb, line 26 def is_allow? true end
Is this a “deny” ACL
entry @return [Boolean] is this a deny entry
# File lib/ood_support/acl_entry.rb, line 32 def is_deny? !is_allow? end
Do the requested args match this ACL
entry? @params principle [String] requested principle @return [Boolean] does this match this entry
# File lib/ood_support/acl_entry.rb, line 39 def match(principle:) self.principle == principle end
Convert object to string @return [String] the string describing this object
# File lib/ood_support/acl_entry.rb, line 45 def to_s principle end