lib/beerdb/reader.rb in beerdb-0.6.0 vs lib/beerdb/reader.rb in beerdb-0.6.1

- old
+ new

@@ -113,11 +113,11 @@ reader = HashReader.new( path ) reader.each do |key, value| brewery = Brewery.find_by_key!( key ) - if value =~ /(?:([0-9][0-9_]*[0-9]|[0-9])\s*hl)/ # e.g. 20_0000 hl or 50hl etc. - prod = $1.gsub(/_/, '').to_i + if value =~ /(?:([0-9][0-9_ ]+[0-9]|[0-9]{1,2})\s*hl)/ # e.g. 20_0000 hl or 50hl etc. + prod = $1.gsub(/[ _]/, '').to_i logger.debug " adding #{key} => >#{prod}<" brewery.prod = prod brewery.save! else logger.warn " unknown type for brewery prod value >#{value}<; regex pattern match failed"