Class: CLASP::AliasSpecification

Inherits:
Object
  • Object
show all
Defined in:
lib/clasp/specifications.rb

Overview

A class that represents an explicit alias for a flag or an option

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, aliases) ⇒ AliasSpecification

Returns a new instance of AliasSpecification.



356
357
358
359
360
361
362
# File 'lib/clasp/specifications.rb', line 356

def initialize(name, aliases)

  @name     = name
  @aliases  = (aliases || []).select { |a| a and not a.empty? }
  @extras   = nil
  @help     = nil
end

Instance Attribute Details

#aliasesObject (readonly)

The alias’ aliases array



367
368
369
# File 'lib/clasp/specifications.rb', line 367

def aliases
  @aliases
end

#extrasObject (readonly)

The flag’s extras



371
372
373
# File 'lib/clasp/specifications.rb', line 371

def extras
  @extras
end

#helpObject (readonly)

The flag’s help string



369
370
371
# File 'lib/clasp/specifications.rb', line 369

def help
  @help
end

#nameObject (readonly)

The alias’ name string



365
366
367
# File 'lib/clasp/specifications.rb', line 365

def name
  @name
end

Instance Method Details

#to_sObject

String form of the option



374
375
376
377
# File 'lib/clasp/specifications.rb', line 374

def to_s

  "{#{name}; aliases=#{aliases.join(', ')}}"
end