Class: KXI::CLI::Argument
- Inherits:
-
Object
- Object
- KXI::CLI::Argument
- Defined in:
- lib/kxi/cli/argument.rb
Overview
Represents argument of command-line interface
Direct Known Subclasses
Instance Method Summary collapse
-
#description ⇒ String
Gets the description of argument.
-
#headline ⇒ String
Gets full descriptive name of argument.
-
#initialize(nm, desc, req, order) ⇒ Argument
constructor
Instantiates the Argument class.
-
#name ⇒ String
Gets the name of argument.
-
#order ⇒ Number
Gets the order of argument (in descending order).
-
#required? ⇒ Bool
Indicates whether argument is mandatory.
-
#syntax ⇒ String
Gets syntax of argument.
Constructor Details
#initialize(nm, desc, req, order) ⇒ Argument
Instantiates the KXI::CLI::Argument class
48 49 50 51 52 53 54 |
# File 'lib/kxi/cli/argument.rb', line 48 def initialize(nm, desc, req, order) raise(Exception.new('Invalid argument name!')) unless /^[A-Za-z0-9\-]+$/m =~ nm @name = nm.downcase @desc = desc @req = req @order = order end |
Instance Method Details
#description ⇒ String
Gets the description of argument
27 28 29 |
# File 'lib/kxi/cli/argument.rb', line 27 def description @desc end |
#headline ⇒ String
Gets full descriptive name of argument
21 22 23 |
# File 'lib/kxi/cli/argument.rb', line 21 def headline name end |
#name ⇒ String
Gets the name of argument
9 10 11 |
# File 'lib/kxi/cli/argument.rb', line 9 def name @name end |
#order ⇒ Number
Gets the order of argument (in descending order)
39 40 41 |
# File 'lib/kxi/cli/argument.rb', line 39 def order @order end |
#required? ⇒ Bool
Indicates whether argument is mandatory
33 34 35 |
# File 'lib/kxi/cli/argument.rb', line 33 def required? @req end |
#syntax ⇒ String
Gets syntax of argument
15 16 17 |
# File 'lib/kxi/cli/argument.rb', line 15 def syntax name end |