lib/engineyard-serverside/configuration.rb in engineyard-serverside-2.0.2 vs lib/engineyard-serverside/configuration.rb in engineyard-serverside-2.0.3
- old
+ new
@@ -20,10 +20,19 @@
end
end
# Calls def_option and adds a name? predicate method
def self.def_boolean_option(name, default=nil, &block)
- def_option(name, default, &block)
+ key ||= name.to_s
+
+ define_method(name) do
+ if block
+ val = fetch(key) {instance_eval(&block)}
+ else
+ val = fetch(key, default)
+ end
+ not [false,nil,'false','nil'].include?(val) # deal with command line options turning booleans into strings
+ end
alias_method(:"#{name}?", name)
end
# Required options do not have a default value.
# An option being required does not mean that it is always supplied,