Class: Thor::IncludedOption
- Inherits:
-
SharedOption
- Object
- Argument
- Option
- SharedOption
- Thor::IncludedOption
- Defined in:
- lib/thor/parser/shared_option.rb
Constant Summary
Constants inherited from Option
Constants inherited from Argument
Instance Attribute Summary collapse
-
#match ⇒ Hash
readonly
The match that resulted in this option getting included.
Attributes inherited from SharedOption
Attributes inherited from Option
#aliases, #hide, #lazy_default
Attributes inherited from Argument
#banner, #complete, #default, #description, #enum, #name, #required, #type
Instance Method Summary collapse
- #default_group ⇒ Object
- #group ⇒ Object
-
#initialize(option:, match:) ⇒ IncludedOption
constructor
A new instance of IncludedOption.
Methods inherited from SharedOption
Methods inherited from Option
alias_to_switch_name, #all_switch_names, #all_switch_tokens, #dasherize, #dasherized?, #human_name, #long_switch_names, #long_switch_tokens, parse, #short_switch_names, #short_switch_tokens, #switch_name, #undasherize, #usage, #validate!, #validate_default_type!
Methods inherited from Argument
#default_banner, #required?, #show_default?, #usage, #valid_type?, #validate!
Constructor Details
#initialize(option:, match:) ⇒ IncludedOption
Returns a new instance of IncludedOption.
86 87 88 89 |
# File 'lib/thor/parser/shared_option.rb', line 86 def initialize option:, match: super option.name, **option. @match = match end |
Instance Attribute Details
#match ⇒ Hash (readonly)
The match that resulted in this option getting included.
83 84 85 |
# File 'lib/thor/parser/shared_option.rb', line 83 def match @match end |
Instance Method Details
#default_group ⇒ Object
110 111 112 113 114 |
# File 'lib/thor/parser/shared_option.rb', line 110 def default_group return nil unless match[:groups] match[:groups].map { |group| group.to_s.titleize }.join ' / ' end |
#group ⇒ Object
93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/thor/parser/shared_option.rb', line 93 def group case @group when false nil when String @group when nil default_group else logger.warn "Bad {Option#group}: #{ @group.inspect }", option: self nil end end |