class Rice::Dining::Manifest

Attributes

allergens[R]
locations[R]
title[R]

Public Class Methods

new(title, locations, allergens) click to toggle source
# File lib/rice/dining.rb, line 14
def initialize title, locations, allergens
  title = title ? title.dup.freeze : 'Dining'.freeze
  raise ArgumentError unless title.is_a? String and locations.is_a? Enumerable and allergens.is_a? Enumerable
  @title = title
  @locations, @allergens = [], Set.new
  locations.each do |location|
    raise ArgumentError unless location.is_a?(Rice::Dining::Location)
    @locations << location
  end
  @locations.freeze

  allergens.each do |allergen|
    raise ArgumentError unless allergen.is_a?(Rice::Dining::Allergen)
    @allergens << allergen
  end
  @allergens.freeze

  self.freeze
end