lib/okapi/spec_parser.rb in okapi-0.0.3 vs lib/okapi/spec_parser.rb in okapi-0.0.4
- old
+ new
@@ -24,19 +24,20 @@
end
def read_file(path)
@data = []
File.open(path).each do |line|
- @data << line
+ @data << line if line.strip != ""
end
@data
end
def parse_data
@data.each { |res|
splited = res.split(' ',3)
+
begin
- splited[2] = JSON.parse splited[2] if splited[2]
+ splited[2] = JSON.parse splited[2] if splited[2] and splited[2] != ''
rescue Exception => e
raise Exception, 'can not parse parameters for resource:' + res + "(#{e})"
end
out = {
'resource' => splited[1],