Class: PlistParser
Overview
Define class PlistParser
Constant Summary collapse
- EMPTY_STRING =
''.freeze
Instance Method Summary collapse
-
#initialize(file_path) ⇒ PlistParser
constructor
A new instance of PlistParser.
- #parse ⇒ Object
Constructor Details
#initialize(file_path) ⇒ PlistParser
Returns a new instance of PlistParser.
17 18 19 |
# File 'lib/kanseishitsu/plist_parser.rb', line 17 def initialize(file_path) @file_path = file_path end |
Instance Method Details
#parse ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/kanseishitsu/plist_parser.rb', line 21 def parse xml = File.read(@file_path) document = REXML::Document.new(xml) plist = parse_element(document.root.elements[1]) # the root <dict> inside <plist> LaunchAgentPlist.new( plist['Label'], plist['ProgramArguments'], plist['StartInterval'] || plist['CalendarStartInterval'] ) end |