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



10
11
12
# File 'lib/ehbrs_ruby_utils/cooking_book/recipe.rb', line 10

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

Instance Method Details

#notesObject



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

def notes
  source_data[:notes]
end

#partsObject



27
28
29
30
31
# File 'lib/ehbrs_ruby_utils/cooking_book/recipe.rb', line 27

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

#titleObject



19
20
21
# File 'lib/ehbrs_ruby_utils/cooking_book/recipe.rb', line 19

def title
  source_data.fetch(:title)
end