Class: CLI::DSL::Switch
Direct Known Subclasses
Option
Instance Attribute Summary
Attributes inherited from Base
#name
Instance Method Summary
collapse
#description, #description?
Constructor Details
#initialize(name, options = {}) ⇒ Switch
Returns a new instance of Switch.
Instance Method Details
#has_short? ⇒ Boolean
126
127
128
|
# File 'lib/cli/dsl.rb', line 126
def has_short?
@options.member? :short
end
|
#short ⇒ Object
130
131
132
|
# File 'lib/cli/dsl.rb', line 130
def short
@options[:short]
end
|
#switch ⇒ Object
134
135
136
|
# File 'lib/cli/dsl.rb', line 134
def switch
'--' + name.to_s.tr('_', '-')
end
|
#switch_short ⇒ Object
138
139
140
|
# File 'lib/cli/dsl.rb', line 138
def switch_short
'-' + short.to_s
end
|
#to_s ⇒ Object
142
143
144
|
# File 'lib/cli/dsl.rb', line 142
def to_s
switch
end
|