lib/rapidoc/yaml_parser.rb in rapidoc-0.0.6 vs lib/rapidoc/yaml_parser.rb in rapidoc-0.0.7

- old
+ new

@@ -12,19 +12,19 @@ # @param blocks [Hash] lines of blocks, example: { init: 1, end: 4 } # @return [Hash] resource info # def extract_resource_info( lines, blocks, file_name ) blocks ? info = [] : blocks = [] - blocks.each.map do |b| if lines[ b[:init] ].include? "=begin resource" n_lines = b[:end] - b[:init] - 1 - begin info.push YAML.load( lines[ b[:init] +1, n_lines ].join.gsub(/\ *#/, '') ) - rescue SyntaxError => e + rescue Psych::SyntaxError => e puts "Error parsing block in #{file_name} file [#{b[:init]} - #{b[:end]}]" + rescue => e + puts e end end end info.first ? info.first : {} @@ -42,10 +42,10 @@ blocks = [] unless blocks blocks.each do |b| if lines[ b[:init] ].include? "=begin action" n_lines = b[:end] - b[:init] - 1 - + begin info << YAML.load( lines[ b[:init] + 1, n_lines ].join.gsub(/\ *#/, '') ) rescue Exception => e puts "Error parsing block in #{file_name} file [#{b[:init]} - #{b[:end]}]" end