Class: CommandBuilderGenerator::CommandArgument
- Inherits:
-
Object
- Object
- CommandBuilderGenerator::CommandArgument
- Defined in:
- lib/command_builder_generator/command_argument.rb
Instance Method Summary collapse
- #arg_name ⇒ Object
- #delimiter ⇒ Object
-
#initialize(arg_text, required = true) ⇒ CommandArgument
constructor
A new instance of CommandArgument.
- #key_value_separator ⇒ Object
- #optional? ⇒ Boolean
- #required? ⇒ Boolean
Constructor Details
#initialize(arg_text, required = true) ⇒ CommandArgument
Returns a new instance of CommandArgument.
4 5 6 7 |
# File 'lib/command_builder_generator/command_argument.rb', line 4 def initialize(arg_text, required=true) @arg_text = arg_text @required = required end |
Instance Method Details
#arg_name ⇒ Object
9 10 11 |
# File 'lib/command_builder_generator/command_argument.rb', line 9 def arg_name @arg_name ||= @arg_text[/<(\w+)/, 1] end |
#delimiter ⇒ Object
17 18 19 |
# File 'lib/command_builder_generator/command_argument.rb', line 17 def delimiter @delimiter ||= @arg_text[/(\W)>/, 1] end |
#key_value_separator ⇒ Object
13 14 15 |
# File 'lib/command_builder_generator/command_argument.rb', line 13 def key_value_separator @key_value_separator ||= @arg_text[/(\W)\W>/, 1] end |
#optional? ⇒ Boolean
25 26 27 |
# File 'lib/command_builder_generator/command_argument.rb', line 25 def optional? !required? end |
#required? ⇒ Boolean
21 22 23 |
# File 'lib/command_builder_generator/command_argument.rb', line 21 def required? @required end |