module FoodFishParser::Flat::AreaFao
Constants
- REGEX
- REGEX_CODE
Public Class Methods
find_all(text)
click to toggle source
# File lib/food_fish_parser/flat/area_fao.rb, line 29 def self.find_all(text) find_all_code_groups(text) .map {|a| { text: nil, fao_codes: a } } end
find_all_code_groups(text)
click to toggle source
# File lib/food_fish_parser/flat/area_fao.rb, line 21 def self.find_all_code_groups(text) text .scan(REGEX) .flatten(1) .map {|s| s.split(/\s*(?: en | ,\s*en | , | \/ )\s*/xi) } .map {|a| a.map {|s| s.gsub(/\A0(\d{2})\z/, '\1') } } # normalize trailing zeroes end