Class: Thor::SharedOption
- Defined in:
- lib/thor/parser/shared_option.rb
Overview
Direct Known Subclasses
Constant Summary
Constants inherited from Option
Constants inherited from Argument
Instance Attribute Summary collapse
-
#groups ⇒ Set<Symbol>
readonly
Shared option groups this option belongs to.
Attributes inherited from Option
#aliases, #group, #hide, #lazy_default
Attributes inherited from Argument
#banner, #complete, #default, #description, #enum, #name, #required, #type
Instance Method Summary collapse
-
#initialize(name, **options) ⇒ SharedOption
constructor
A new instance of SharedOption.
- #initialize_options ⇒ Object
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(name, **options) ⇒ SharedOption
Returns a new instance of SharedOption.
40 41 42 43 44 45 46 47 48 49 |
# File 'lib/thor/parser/shared_option.rb', line 40 def initialize name, ** @groups = Set.new [*[:groups]].map( &:to_sym ) # # If # if options[:group].nil? && groups.count == 1 # options[:group] = groups.first.to_s.titleize # end super name, end |
Instance Attribute Details
#groups ⇒ Set<Symbol> (readonly)
Shared option groups this option belongs to.
36 37 38 |
# File 'lib/thor/parser/shared_option.rb', line 36 def groups @groups end |
Instance Method Details
#initialize_options ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/thor/parser/shared_option.rb', line 52 def { # {Thor::Argument} options desc: :@description, required: :@required, type: :@type, default: :@default, banner: :@banner, eunm: :@enum, # {Thor::Option} options check_default_type: :@check_default_type, lazy_default: :@lazy_default, group: :@group, aliases: :@aliases, hide: :@hide, # {Thor::SharedOption} options groups: :@groups, }.transform_values &method( :instance_variable_get ) end |