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
8 9 10 |
# File 'lib/eac_cli/definition/boolean_option.rb', line 8 def argument? false end |
#build_value(_new_value, previous_value) ⇒ Object
12 13 14 |
# File 'lib/eac_cli/definition/boolean_option.rb', line 12 def build_value(_new_value, previous_value) repeat? ? previous_value + 1 : true end |
#default_default_value ⇒ Object
22 23 24 |
# File 'lib/eac_cli/definition/boolean_option.rb', line 22 def default_default_value repeat? ? 0 : false end |
#default_value ⇒ Object
16 17 18 19 20 |
# File 'lib/eac_cli/definition/boolean_option.rb', line 16 def default_value return super unless default_value? raise("Unallowed default value for boolean options (Option: #{self})") end |