Class: FPM::Cookery::Book

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/fpm/cookery/book.rb

Instance Method Summary collapse

Constructor Details

#initializeBook

Returns a new instance of Book.



8
9
10
# File 'lib/fpm/cookery/book.rb', line 8

def initialize
  @recipe = nil
end

Instance Method Details

#add_recipe_class(klass) ⇒ Object



19
20
21
# File 'lib/fpm/cookery/book.rb', line 19

def add_recipe_class(klass)
  @recipe = klass
end

#load_recipe(filename, config, &callback) ⇒ Object

Load the given file and instantiate an object. Wrap the class in an anonymous module to avoid namespace cluttering. (see Kernel.load)



14
15
16
17
# File 'lib/fpm/cookery/book.rb', line 14

def load_recipe(filename, config, &callback)
  Kernel.load(filename, true)
  callback.call(@recipe.new(filename, config))
end