Class: CTioga2::Commands::CommandArgument

Inherits:
Object
  • Object
show all
Defined in:
lib/ctioga2/commands/arguments.rb

Overview

An argument to a Command

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, name = nil, desc = nil) ⇒ CommandArgument

type is a named CommandType



37
38
39
40
41
# File 'lib/ctioga2/commands/arguments.rb', line 37

def initialize(type, name = nil, desc = nil)
  @type = CommandType.get_type(type)
  @name = name
  @description = desc
end

Instance Attribute Details

#descriptionObject

A small description of the argument



34
35
36
# File 'lib/ctioga2/commands/arguments.rb', line 34

def description
  @description
end

#nameObject

The name of the argument. Uniquely for display in the help documentation.



31
32
33
# File 'lib/ctioga2/commands/arguments.rb', line 31

def name
  @name
end

#typeObject

The type of the argument, a CTioga2::MetaBuilder::Type object.



27
28
29
# File 'lib/ctioga2/commands/arguments.rb', line 27

def type
  @type
end

Instance Method Details

#displayed_nameObject

Returns a name suitable for display in a documentation, such as the command-line help.



45
46
47
48
49
50
51
# File 'lib/ctioga2/commands/arguments.rb', line 45

def displayed_name
  if @name
    return @name
  else
    return @type.name
  end
end