Sha256: a92eab838bba1aa431e7a9708bc891f436d3c4586a473b5c179e2df0544ff6cb

Contents?: true

Size: 721 Bytes

Versions: 26

Compression:

Stored size: 721 Bytes

Contents

# frozen_string_literal: true

require 'eac_ruby_utils/core_ext'
require 'eac_ruby_utils/yaml'

module Ehbrs
  module CookingBook
    class Recipe
      enable_simple_cache
      require_sub __FILE__

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

      common_constructor :source_data do
        self.source_data = source_data.deep_symbolize_keys
      end

      def title
        source_data.fetch(:title)
      end

      def notes
        source_data[:notes]
      end

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

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
ehbrs-tools-0.35.1 lib/ehbrs/cooking_book/recipe.rb
ehbrs-tools-0.35.0 lib/ehbrs/cooking_book/recipe.rb
ehbrs-tools-0.34.0 lib/ehbrs/cooking_book/recipe.rb
ehbrs-tools-0.33.0 lib/ehbrs/cooking_book/recipe.rb
ehbrs-tools-0.32.0 lib/ehbrs/cooking_book/recipe.rb
ehbrs-tools-0.31.1 lib/ehbrs/cooking_book/recipe.rb
ehbrs-tools-0.31.0 lib/ehbrs/cooking_book/recipe.rb
ehbrs-tools-0.30.0 lib/ehbrs/cooking_book/recipe.rb
ehbrs-tools-0.29.0 lib/ehbrs/cooking_book/recipe.rb
ehbrs-tools-0.28.3 lib/ehbrs/cooking_book/recipe.rb
ehbrs-tools-0.28.2 lib/ehbrs/cooking_book/recipe.rb
ehbrs-tools-0.28.1 lib/ehbrs/cooking_book/recipe.rb
ehbrs-tools-0.28.0 lib/ehbrs/cooking_book/recipe.rb
ehbrs-tools-0.27.0 lib/ehbrs/cooking_book/recipe.rb
ehbrs-tools-0.26.0 lib/ehbrs/cooking_book/recipe.rb
ehbrs-tools-0.25.1 lib/ehbrs/cooking_book/recipe.rb
ehbrs-tools-0.25.0 lib/ehbrs/cooking_book/recipe.rb
ehbrs-tools-0.24.0 lib/ehbrs/cooking_book/recipe.rb
ehbrs-tools-0.23.1 lib/ehbrs/cooking_book/recipe.rb
ehbrs-tools-0.23.0 lib/ehbrs/cooking_book/recipe.rb