Class: EhbrsRubyUtils::CookingBook::Recipe

Inherits:
Object
  • Object
show all
Defined in:
lib/ehbrs_ruby_utils/cooking_book/recipe.rb,
lib/ehbrs_ruby_utils/cooking_book/recipe/part.rb,
lib/ehbrs_ruby_utils/cooking_book/recipe/measure.rb,
lib/ehbrs_ruby_utils/cooking_book/recipe/ingredient.rb

Defined Under Namespace

Classes: Ingredient, Measure, Part

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_file(path) ⇒ Object



13
14
15
# File 'lib/ehbrs_ruby_utils/cooking_book/recipe.rb', line 13

def from_file(path)
  new(::EacRubyUtils::Yaml.load_file(path))
end

Instance Method Details

#notesObject



26
27
28
# File 'lib/ehbrs_ruby_utils/cooking_book/recipe.rb', line 26

def notes
  source_data[:notes]
end

#partsObject



30
31
32
33
34
# File 'lib/ehbrs_ruby_utils/cooking_book/recipe.rb', line 30

def parts
  @parts ||= source_data.fetch(:parts).map do |k, v|
    ::EhbrsRubyUtils::CookingBook::Recipe::Part.new(k, v)
  end
end

#titleObject



22
23
24
# File 'lib/ehbrs_ruby_utils/cooking_book/recipe.rb', line 22

def title
  source_data.fetch(:title)
end