lib/eco-rake/option/mirror.rb in eco-rake-0.1.6 vs lib/eco-rake/option/mirror.rb in eco-rake-0.2.0
- old
+ new
@@ -11,24 +11,24 @@
missing = (value == :not_used) && !default?
msg = "required argument value #{argument} for option #{name} (#{short})"
raise ArgumentError, msg if missing && argument_required? && raise
return nil if missing && argument_required?
- value = value == :not_used ? default : value
+ value = default if value == :not_used
"#{opt} \"#{value}\""
end
private
# Implements the mirror of Boolean options/switches.
def boolean_mirror(value = :not_used)
opt = name_hyphened
- puts "boolean_mirror (#{value}): #{opt}" if name == :no_get
+ # puts "boolean_mirror (#{value}): #{opt}" if name == :no_get
return nil unless [TrueClass, NilClass, FalseClass].any? {|klass| type_coercion == klass}
enabled_value = !boolean_name? || [TrueClass, NilClass].any? {|klass| type_coercion == klass}
- return opt if value == enabled_value
- return name_false_hypen if boolean_name? && value == !enabled_value
+ return opt if value == enabled_value
+ name_false_hypen if boolean_name? && value == !enabled_value
end
end
end
end