Class: OSX::ACL::Entry

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/acl/entry.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#componentsObject

Returns the value of attribute components.



6
7
8
# File 'lib/acl/entry.rb', line 6

def components
  @components
end

Class Method Details

.from_text(text) ⇒ Object



8
9
10
# File 'lib/acl/entry.rb', line 8

def self.from_text(text)
  new.tap {|entry| entry.components = text.split(":") }
end

Instance Method Details

#<=>(other) ⇒ Object



12
13
14
# File 'lib/acl/entry.rb', line 12

def <=>(other)
  components <=> other.components
end

#assignmentObject



36
37
38
# File 'lib/acl/entry.rb', line 36

def assignment
  ACL::Assignment.new(assignment_components)
end

#assignment_componentsObject



40
41
42
# File 'lib/acl/entry.rb', line 40

def assignment_components
  components[0..-3]
end

#inherited=(should_inherit) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/acl/entry.rb', line 20

def inherited=(should_inherit)
  if should_inherit && !inherited?
    rules << "inherited"
  elsif inherited? && !should_inherit
    rules.delete("inherited")
  end
end

#inherited?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/acl/entry.rb', line 28

def inherited?
  rules.include? "inherited"
end

#orphaned?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/acl/entry.rb', line 32

def orphaned?
  assignment.orphan?
end

#permissionsObject



44
45
46
# File 'lib/acl/entry.rb', line 44

def permissions
  components.last.split(",")
end

#rulesObject



48
49
50
# File 'lib/acl/entry.rb', line 48

def rules
  components[-2].split(",")
end

#to_sObject



16
17
18
# File 'lib/acl/entry.rb', line 16

def to_s
  components.join(":")
end