Module: Hibachi::Recipe::ClassMethods

Defined in:
lib/hibachi/recipe.rb

Instance Method Summary collapse

Instance Method Details

#recipe(name, options = {}) ⇒ Object Also known as: collection_recipe

Set the recipe on this model. You can feel free to omit the ‘::default’, but if you have a ‘::’ in there the code will not touch this name. By default, this creates a ‘collection’ recipe.



14
15
16
17
18
# File 'lib/hibachi/recipe.rb', line 14

def recipe name, options={}
  self.recipe_name = name
  from_opts = options[:type] || 'collection'
  self.recipe_type = ActiveSupport::StringInquirer.new from_opts.to_s
end

#singleton_recipe(name) ⇒ Object

Shorthand for creating a ‘singleton’ recipe, you can also simply pass :type => :singleton in the ‘recipe` call.



25
26
27
# File 'lib/hibachi/recipe.rb', line 25

def singleton_recipe name
  recipe name, :type => :singleton
end