Module: EcoRake::Option::Mirror
- Included in:
- EcoRake::Option
- Defined in:
- lib/eco-rake/option/mirror.rb
Instance Method Summary collapse
-
#mirror(value = :not_used, raise: false) ⇒ String
It allows to redirect options.
Instance Method Details
#mirror(value = :not_used, raise: false) ⇒ String
It allows to redirect options
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/eco-rake/option/mirror.rb', line 7 def mirror(value = :not_used, raise: false) opt = name_hyphened return boolean_mirror(value) unless argument? 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 = default if value == :not_used "#{opt} \"#{value}\"" end |