Class: LaunchdTools::Path
- Inherits:
-
Object
- Object
- LaunchdTools::Path
show all
- Defined in:
- lib/launchd_tools/path.rb
Defined Under Namespace
Classes: PermissionsError, UnparsablePlist
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(path) ⇒ Path
Returns a new instance of Path.
15
16
17
|
# File 'lib/launchd_tools/path.rb', line 15
def initialize(path)
@path = path
end
|
Instance Attribute Details
#path ⇒ Object
Returns the value of attribute path.
13
14
15
|
# File 'lib/launchd_tools/path.rb', line 13
def path
@path
end
|
Instance Method Details
#content ⇒ Object
24
25
26
|
# File 'lib/launchd_tools/path.rb', line 24
def content
PathContent.new(path).to_s
end
|
#expanded ⇒ Object
42
43
44
|
# File 'lib/launchd_tools/path.rb', line 42
def expanded
File.expand_path(path)
end
|
#parse ⇒ Object
28
29
30
31
32
33
34
35
36
|
# File 'lib/launchd_tools/path.rb', line 28
def parse
begin
path_parser.parse
rescue Errno::EACCES
raise PermissionsError.new
rescue
raise UnparsablePlist.new
end
end
|
#path_parser ⇒ Object
38
39
40
|
# File 'lib/launchd_tools/path.rb', line 38
def path_parser
PathParser.new(self)
end
|
#validate ⇒ Object
19
20
21
22
|
# File 'lib/launchd_tools/path.rb', line 19
def validate
raise PathMissingError unless File.exist?(path)
self
end
|