Class: LaunchdTools::PathParser

Inherits:
Object
  • Object
show all
Defined in:
lib/launchd_tools/path_parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ PathParser

Returns a new instance of PathParser.



11
12
13
# File 'lib/launchd_tools/path_parser.rb', line 11

def initialize(path)
  @path = path
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



10
11
12
# File 'lib/launchd_tools/path_parser.rb', line 10

def path
  @path
end

#xml_docObject (readonly)

Returns the value of attribute xml_doc.



10
11
12
# File 'lib/launchd_tools/path_parser.rb', line 10

def xml_doc
  @xml_doc
end

Instance Method Details

#parseObject

returns a parsed launchd job



16
17
18
# File 'lib/launchd_tools/path_parser.rb', line 16

def parse
  LaunchdJob.new({ 'EnvironmentVariables' => parse_env, 'ProgramArguments' => parse_program_args })
end

#parse_envObject



20
21
22
23
# File 'lib/launchd_tools/path_parser.rb', line 20

def parse_env
  variables = EnvironmentParser.new(xml_doc).parse
  EnvironmentVariables.new(variables).to_a
end

#parse_program_argsObject



25
26
27
# File 'lib/launchd_tools/path_parser.rb', line 25

def parse_program_args
  ProgramArgsParser.new(xml_doc).parse
end