Class: FPM::Cookery::Book
- Inherits:
-
Object
- Object
- FPM::Cookery::Book
- Defined in:
- lib/fpm/cookery/book.rb
Class Method Summary collapse
-
.load_recipe(filename, &callback) ⇒ Object
Load the given file and instantiate an object.
- .loaded_recipe(klass) ⇒ Object
Class Method Details
.load_recipe(filename, &callback) ⇒ Object
Load the given file and instantiate an object. Wrap the class in an anonymous module to avoid namespace cluttering. (see Kernel.load)
6 7 8 9 |
# File 'lib/fpm/cookery/book.rb', line 6 def self.load_recipe(filename, &callback) Kernel.load(filename, true) callback.call(@recipe.new(filename)) end |
.loaded_recipe(klass) ⇒ Object
11 12 13 |
# File 'lib/fpm/cookery/book.rb', line 11 def self.loaded_recipe(klass) @recipe = klass end |