Class: GoldenRose::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/golden_rose/parser.rb

Constant Summary collapse

FILE_NAME =
"action_TestSummaries.plist"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(folder_path) ⇒ Parser

Returns a new instance of Parser.



14
15
16
# File 'lib/golden_rose/parser.rb', line 14

def initialize(folder_path)
  @folder_path = folder_path
end

Instance Attribute Details

#folder_pathObject

Returns the value of attribute folder_path.



12
13
14
# File 'lib/golden_rose/parser.rb', line 12

def folder_path
  @folder_path
end

#parsed_plistObject

Returns the value of attribute parsed_plist.



12
13
14
# File 'lib/golden_rose/parser.rb', line 12

def parsed_plist
  @parsed_plist
end

Instance Method Details

#parse!Object



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/golden_rose/parser.rb', line 18

def parse!
  archive? ? open_zip : open_directory
  raise GeneratingError, "File 'TestSummaries.plist' was not found in the folder." unless @plist_file_path
  @parsed_plist = Plist::parse_xml(@plist_file_path)
  File.delete(@plist_file_path) if archive?
  raise GeneratingError, "Could not parse plist correctly." unless parsed_plist
  parsed_plist

rescue Zip::Error, Errno::ENOENT
  raise GeneratingError, "Could not open the folder."
end