Class: CommandBuilder::CodeGenerator::CommandArgument
- Inherits:
-
Object
- Object
- CommandBuilder::CodeGenerator::CommandArgument
- Defined in:
- lib/command_builder/code_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.
5 6 7 8 |
# File 'lib/command_builder/code_generator/command_argument.rb', line 5 def initialize(arg_text, required=true) @arg_text = arg_text @required = required end |
Instance Method Details
#arg_name ⇒ Object
10 11 12 |
# File 'lib/command_builder/code_generator/command_argument.rb', line 10 def arg_name @arg_name ||= @arg_text[/<(\w+)/, 1] end |
#delimiter ⇒ Object
18 19 20 |
# File 'lib/command_builder/code_generator/command_argument.rb', line 18 def delimiter @delimiter ||= @arg_text[/(\W)>/, 1] end |
#key_value_separator ⇒ Object
14 15 16 |
# File 'lib/command_builder/code_generator/command_argument.rb', line 14 def key_value_separator @key_value_separator ||= @arg_text[/(\W)\W>/, 1] end |
#optional? ⇒ Boolean
26 27 28 |
# File 'lib/command_builder/code_generator/command_argument.rb', line 26 def optional? !required? end |
#required? ⇒ Boolean
22 23 24 |
# File 'lib/command_builder/code_generator/command_argument.rb', line 22 def required? @required end |