Class: CLASP::AliasSpecification
- Inherits:
-
Object
- Object
- CLASP::AliasSpecification
- Defined in:
- lib/clasp/specifications.rb
Overview
A class that represents an explicit alias for a flag or an option
Instance Attribute Summary collapse
-
#aliases ⇒ Object
readonly
The alias’ aliases array.
-
#extras ⇒ Object
readonly
The flag’s extras.
-
#help ⇒ Object
readonly
The flag’s help string.
-
#name ⇒ Object
readonly
The alias’ name string.
Instance Method Summary collapse
-
#initialize(name, aliases) ⇒ AliasSpecification
constructor
A new instance of AliasSpecification.
-
#to_s ⇒ Object
String form of the option.
Constructor Details
#initialize(name, aliases) ⇒ AliasSpecification
Returns a new instance of AliasSpecification.
355 356 357 358 359 360 361 |
# File 'lib/clasp/specifications.rb', line 355 def initialize(name, aliases) @name = name @aliases = (aliases || []).select { |a| a and not a.empty? } @extras = nil @help = nil end |
Instance Attribute Details
#aliases ⇒ Object (readonly)
The alias’ aliases array
366 367 368 |
# File 'lib/clasp/specifications.rb', line 366 def aliases @aliases end |
#extras ⇒ Object (readonly)
The flag’s extras
370 371 372 |
# File 'lib/clasp/specifications.rb', line 370 def extras @extras end |
#help ⇒ Object (readonly)
The flag’s help string
368 369 370 |
# File 'lib/clasp/specifications.rb', line 368 def help @help end |
#name ⇒ Object (readonly)
The alias’ name string
364 365 366 |
# File 'lib/clasp/specifications.rb', line 364 def name @name end |
Instance Method Details
#to_s ⇒ Object
String form of the option
373 374 375 376 |
# File 'lib/clasp/specifications.rb', line 373 def to_s "{#{name}; aliases=#{aliases.join(', ')}}" end |