Class: Clamp::Subcommand::Definition

Inherits:
Struct
  • Object
show all
Defined in:
lib/clamp/subcommand/definition.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(names, description, subcommand_class) ⇒ Definition

Returns a new instance of Definition.



8
9
10
11
# File 'lib/clamp/subcommand/definition.rb', line 8

def initialize(names, description, subcommand_class)
  names = Array(names)
  super
end

Instance Attribute Details

#descriptionObject

Returns the value of attribute description

Returns:

  • (Object)

    the current value of description



6
7
8
# File 'lib/clamp/subcommand/definition.rb', line 6

def description
  @description
end

#namesObject

Returns the value of attribute names

Returns:

  • (Object)

    the current value of names



6
7
8
# File 'lib/clamp/subcommand/definition.rb', line 6

def names
  @names
end

#subcommand_classObject

Returns the value of attribute subcommand_class

Returns:

  • (Object)

    the current value of subcommand_class



6
7
8
# File 'lib/clamp/subcommand/definition.rb', line 6

def subcommand_class
  @subcommand_class
end

Instance Method Details

#helpObject



17
18
19
# File 'lib/clamp/subcommand/definition.rb', line 17

def help
  [names.join(", "), description]
end

#is_called?(name) ⇒ Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/clamp/subcommand/definition.rb', line 13

def is_called?(name)
  names.member?(name)
end