Class: Cosing::Annex::II

Inherits:
Base
  • Object
show all
Defined in:
lib/cosing/annex/ii.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



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/cosing/annex/ii.rb', line 10

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