Class: OSX::ACL::Entries
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- OSX::ACL::Entries
- Defined in:
- lib/acl.rb
Instance Attribute Summary collapse
-
#acl ⇒ Object
readonly
Returns the value of attribute acl.
Instance Method Summary collapse
- #as_inherited ⇒ Object
-
#initialize(acl, entries) ⇒ Entries
constructor
A new instance of Entries.
- #remove_if ⇒ Object
Constructor Details
#initialize(acl, entries) ⇒ Entries
Returns a new instance of Entries.
37 38 39 40 |
# File 'lib/acl.rb', line 37 def initialize(acl, entries) @acl = acl super(entries) end |
Instance Attribute Details
#acl ⇒ Object (readonly)
Returns the value of attribute acl.
36 37 38 |
# File 'lib/acl.rb', line 36 def acl @acl end |
Instance Method Details
#as_inherited ⇒ Object
41 42 43 |
# File 'lib/acl.rb', line 41 def as_inherited map {|entry| entry.inherited = true } end |
#remove_if ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# 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 |