Class: EacCli::Runner::Definition
- Inherits:
-
Object
- Object
- EacCli::Runner::Definition
- Defined in:
- lib/eac_cli/runner/definition.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
Returns the value of attribute description.
-
#options_argument ⇒ Object
Returns the value of attribute options_argument.
Instance Method Summary collapse
- #alt(&block) ⇒ Object
- #alternatives ⇒ Object
- #arg_opt(short, long, description, option_options = {}) ⇒ Object
- #bool_opt(short, long, description, option_options = {}) ⇒ Object
- #desc(description) ⇒ Object
-
#initialize ⇒ Definition
constructor
A new instance of Definition.
- #options ⇒ Object
- #options_arg(options_argument) ⇒ Object
- #pos_arg(name, arg_options = {}) ⇒ Object
- #positional ⇒ Object
Constructor Details
#initialize ⇒ Definition
Returns a new instance of Definition.
15 16 17 18 |
# File 'lib/eac_cli/runner/definition.rb', line 15 def initialize self.description = '-- NO DESCRIPTION SET --' self. = true end |
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description.
12 13 14 |
# File 'lib/eac_cli/runner/definition.rb', line 12 def description @description end |
#options_argument ⇒ Object
Returns the value of attribute options_argument.
13 14 15 |
# File 'lib/eac_cli/runner/definition.rb', line 13 def @options_argument end |
Instance Method Details
#alt(&block) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/eac_cli/runner/definition.rb', line 20 def alt(&block) r = ::EacCli::Runner::Definition.new r.instance_eval(&block) alternatives << r r end |
#alternatives ⇒ Object
27 28 29 |
# File 'lib/eac_cli/runner/definition.rb', line 27 def alternatives @alternatives ||= [] end |
#arg_opt(short, long, description, option_options = {}) ⇒ Object
31 32 33 |
# File 'lib/eac_cli/runner/definition.rb', line 31 def arg_opt(short, long, description, = {}) << ArgumentOption.new(short, long, description, ) end |
#bool_opt(short, long, description, option_options = {}) ⇒ Object
35 36 37 |
# File 'lib/eac_cli/runner/definition.rb', line 35 def bool_opt(short, long, description, = {}) << BooleanOption.new(short, long, description, ) end |
#desc(description) ⇒ Object
39 40 41 |
# File 'lib/eac_cli/runner/definition.rb', line 39 def desc(description) self.description = description end |
#options ⇒ Object
47 48 49 |
# File 'lib/eac_cli/runner/definition.rb', line 47 def @options ||= [] end |
#options_arg(options_argument) ⇒ Object
43 44 45 |
# File 'lib/eac_cli/runner/definition.rb', line 43 def () self. = end |
#pos_arg(name, arg_options = {}) ⇒ Object
51 52 53 |
# File 'lib/eac_cli/runner/definition.rb', line 51 def pos_arg(name, = {}) positional << PositionalArgument.new(name, ) end |
#positional ⇒ Object
55 56 57 |
# File 'lib/eac_cli/runner/definition.rb', line 55 def positional @positional ||= [] end |