Method: Cosing::Annex::IV.load

Defined in:
lib/cosing/annex/iv.rb

.loadObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/cosing/annex/iv.rb', line 15

def self.load
  new.tap do |annex|
    Annex.parse("data/annex.IV.csv") do |row|
      ingredients = Cosing::Parser.transform_array!(
        row,
        key: :identified_ingredients,
        split: ";"
      )

      annex.add_rule(
        row.merge(
          identified_ingredients: ingredients.compact,
          other_restrictions: row[:other]
        )
      )
    end
  end
end