Class: Cosing::Annex::IV

Inherits:
Base
  • Object
show all
Defined in:
lib/cosing/annex/iv.rb

Defined Under Namespace

Classes: Rule

Class Method Summary collapse

Methods inherited from Base

#add_rule, #initialize, #keys, #lookup

Constructor Details

This class inherits a constructor from Cosing::Annex::Base

Class Method Details

.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