class OodSupport::ACLEntry

A helper object that defines a generic ACL entry

Attributes

principle[R]

The principle of this entry @return [String] principle of entry

Public Class Methods

new(principle:) click to toggle source

@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
parse(entry, **kwargs) click to toggle source

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_entry(entry) click to toggle source

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

<=>(other) click to toggle source

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
eql?(other) click to toggle source

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
hash() click to toggle source

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_allow?() click to toggle source

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_deny?() click to toggle source

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
match(principle:) click to toggle source

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
to_s() click to toggle source

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