Class: Clamp::Subcommand::Definition
- Inherits:
-
Struct
- Object
- Struct
- Clamp::Subcommand::Definition
- Defined in:
- lib/clamp/subcommand/definition.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
Returns the value of attribute description.
-
#name ⇒ Object
Returns the value of attribute name.
-
#names ⇒ Object
readonly
Returns the value of attribute names.
-
#subcommand_class ⇒ Object
Returns the value of attribute subcommand_class.
Instance Method Summary collapse
- #help ⇒ Object
-
#initialize(names, description, subcommand_class) ⇒ Definition
constructor
A new instance of Definition.
- #is_called?(name) ⇒ Boolean
Constructor Details
#initialize(names, description, subcommand_class) ⇒ Definition
Returns a new instance of Definition.
8 9 10 11 12 |
# File 'lib/clamp/subcommand/definition.rb', line 8 def initialize(names, description, subcommand_class) @names = Array(names) @description = description @subcommand_class = subcommand_class end |
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description
6 7 8 |
# File 'lib/clamp/subcommand/definition.rb', line 6 def description @description end |
#name ⇒ Object
Returns the value of attribute name
6 7 8 |
# File 'lib/clamp/subcommand/definition.rb', line 6 def name @name end |
#names ⇒ Object (readonly)
Returns the value of attribute names.
14 15 16 |
# File 'lib/clamp/subcommand/definition.rb', line 14 def names @names end |
#subcommand_class ⇒ Object
Returns the value of attribute subcommand_class
6 7 8 |
# File 'lib/clamp/subcommand/definition.rb', line 6 def subcommand_class @subcommand_class end |
Instance Method Details
#help ⇒ Object
20 21 22 |
# File 'lib/clamp/subcommand/definition.rb', line 20 def help [names.join(", "), description] end |
#is_called?(name) ⇒ Boolean
16 17 18 |
# File 'lib/clamp/subcommand/definition.rb', line 16 def is_called?(name) names.member?(name) end |