Class: EacCli::Definition::BooleanOption
- Inherits:
-
Option
- Object
- OptionOrPositional
- Option
- EacCli::Definition::BooleanOption
- Defined in:
- lib/eac_cli/definition/boolean_option.rb
Constant Summary
Constants inherited from Option
Constants inherited from OptionOrPositional
OptionOrPositional::OPTION_LIST
Instance Method Summary collapse
- #argument? ⇒ Boolean
- #build_value(_new_value, previous_value) ⇒ Object
- #default_default_value ⇒ Object
- #default_value ⇒ Object
Methods inherited from Option
#default_value?, from_args, #identifier, #initialize, #show_on_usage?
Methods inherited from OptionOrPositional
#optional?, #raise, #repeat?, #required?, #to_s
Constructor Details
This class inherits a constructor from EacCli::Definition::Option
Instance Method Details
#argument? ⇒ Boolean
6 7 8 |
# File 'lib/eac_cli/definition/boolean_option.rb', line 6 def argument? false end |
#build_value(_new_value, previous_value) ⇒ Object
10 11 12 |
# File 'lib/eac_cli/definition/boolean_option.rb', line 10 def build_value(_new_value, previous_value) repeat? ? previous_value + 1 : true end |
#default_default_value ⇒ Object
20 21 22 |
# File 'lib/eac_cli/definition/boolean_option.rb', line 20 def default_default_value repeat? ? 0 : false end |
#default_value ⇒ Object
14 15 16 17 18 |
# File 'lib/eac_cli/definition/boolean_option.rb', line 14 def default_value return super unless default_value? raise("Unallowed default value for boolean options (Option: #{self})") end |