lib/cosing/annex/ii.rb in cosing-0.2.0 vs lib/cosing/annex/ii.rb in cosing-0.2.1

- old
+ new

@@ -4,8 +4,26 @@ module Annex class II < Base class Rule < Rule attribute :inn, Types::String end + + def self.load + new.tap do |annex| + Annex.parse("data/annex.II.csv") do |row| + ingredients = Cosing::Parser.transform_array!( + row, + key: :identified_ingredients, + split: ";" + ) + + annex.add_rule( + row.merge( + identified_ingredients: ingredients.compact + ) + ) + end + end + end end end end