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.



277
278
279
280
281
282
283
# File 'lib/clasp/specifications.rb', line 277

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



288
289
290
# File 'lib/clasp/specifications.rb', line 288

def aliases
  @aliases
end

#extrasObject (readonly)

The flag’s extras



292
293
294
# File 'lib/clasp/specifications.rb', line 292

def extras
  @extras
end

#helpObject (readonly)

The flag’s help string



290
291
292
# File 'lib/clasp/specifications.rb', line 290

def help
  @help
end

#nameObject (readonly)

The alias’ name string



286
287
288
# File 'lib/clasp/specifications.rb', line 286

def name
  @name
end

Instance Method Details

#to_sObject

String form of the option



295
296
297
298
# File 'lib/clasp/specifications.rb', line 295

def to_s

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