Sha256: 5baa007f501f5f5e028cf6b29ef173cd7e6e237b182557d32f89e9b3f5bef1a9

Contents?: true

Size: 1.05 KB

Versions: 4

Compression:

Stored size: 1.05 KB

Contents

require 'mida_vocabulary/vocabulary'
require 'mida_vocabulary/vocabularies/data_vocabulary/item'

module Mida
  module DataVocabulary
    autoload :Person, 'mida_vocabulary/vocabularies/data_vocabulary/person'
    autoload :Review, 'mida_vocabulary/vocabularies/data_vocabulary/review'

    class Recipe < Mida::Vocabulary
      itemtype %r{http://data-vocabulary.org/Recipe}i
      include_vocabulary Mida::DataVocabulary::Item

      for field in %w{name recipeType photo summary instructions ingredient}
        has_many field
      end

      for field in %w{published prepTime cookTime totalTime}
        has_many(field) { extract Mida::DataType::ISO8601Date }
      end

      has_many 'review' do
        extract Mida::DataVocabulary::Review
        extract Mida::DataType::Text
      end

      # [servingSize, calories, fat, saturatedFat, unsaturatedFat, carbohydrates, sugar, fiber, protein, cholesterol]
      has_many 'nutrition'

      has_many 'author' do
        extract Mida::DataVocabulary::Person
        extract Mida::DataType::Text
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mida_vocabulary-0.2.2 lib/mida_vocabulary/vocabularies/data_vocabulary/recipe.rb
mida_vocabulary-0.2 lib/mida_vocabulary/vocabularies/data_vocabulary/recipe.rb
mida_vocabulary-0.1.3 lib/mida_vocabulary/vocabularies/data_vocabulary/recipe.rb
mida_vocabulary-0.1.2 lib/mida_vocabulary/vocabularies/data_vocabulary/recipe.rb