class OSX::ACL::Entries

Attributes

acl[R]

Public Class Methods

new(acl, entries) click to toggle source
Calls superclass method
# File lib/acl.rb, line 37
def initialize(acl, entries)
  @acl = acl
  super(entries)
end

Public Instance Methods

as_inherited() click to toggle source
# File lib/acl.rb, line 41
def as_inherited
  map {|entry| entry.inherited = true }
end
remove_if() { |entry| ... } click to toggle source
# File lib/acl.rb, line 45
def remove_if
  removal_count = 0
  # we reverse the order of the entries so we can remove entries without affecting the index of other entries
  reverse.each_with_index do |entry,index|
    if yield(entry)
      # since entries are reversed, we calculate the actual index
      actual_index = (length - 1) - index
      if acl.remove_entry_at_index(actual_index)
        removal_count += 1
      else
        raise "Failed to remove #{entry} from #{acl.path}"
      end
    end
  end
  removal_count
end