lib/cany/recipe.rb in cany-0.3.0 vs lib/cany/recipe.rb in cany-0.4.0
- old
+ new
@@ -34,12 +34,12 @@
@spec = spec
@inner = nil
@hooks = Hash[(self.class.defined_hooks || []).map do |name|
[name, Cany.hash_with_array_as_default]
end]
- @options = Hash[(self.class.defined_options || []).map do |name|
- [name, Cany.hash_with_array_as_default]
+ @options = Hash[(self.class.defined_options || {}).map do |name, default|
+ [name, default.dup]
end]
self.class.const_get(:DSL).new(self).exec(&configure_block) if configure_block
end
# Specify the inner recipe for the current one.
@@ -158,12 +158,12 @@
# @api public
# Define a configure option. These kind of option are design for other
# recipes not for the user. See Recipe::DSL for this.
# @param name[Symbol] The name of the option. The option name is scoped
# inside a recipe.
- def option(name)
- @defined_options ||= []
- @defined_options << name
+ def option(name, default={})
+ @defined_options ||= {}
+ @defined_options[name] = default
end
end
def hook(name)
@hooks[name].tap do |hook|