Class: CommandMapper::Gen::Argument
- Defined in:
- lib/command_mapper/gen/argument.rb
Overview
Represents a mock CommandMapper::Argument
class.
Instance Attribute Summary collapse
-
#name ⇒ Symbol
readonly
The name of the argument.
- #repeats ⇒ Boolean? readonly
Attributes inherited from Arg
Instance Method Summary collapse
-
#initialize(name, repeats: nil, **kwargs) ⇒ Argument
constructor
Initializes the parsed argument.
-
#to_ruby ⇒ String
Converts the parsed argument to Ruby source code.
Constructor Details
#initialize(name, repeats: nil, **kwargs) ⇒ Argument
Initializes the parsed argument.
29 30 31 32 33 34 |
# File 'lib/command_mapper/gen/argument.rb', line 29 def initialize(name, repeats: nil, **kwargs) super(**kwargs) @name = name @repeats = repeats end |
Instance Attribute Details
#name ⇒ Symbol (readonly)
The name of the argument.
13 14 15 |
# File 'lib/command_mapper/gen/argument.rb', line 13 def name @name end |
#repeats ⇒ Boolean? (readonly)
16 17 18 |
# File 'lib/command_mapper/gen/argument.rb', line 16 def repeats @repeats end |
Instance Method Details
#to_ruby ⇒ String
Converts the parsed argument to Ruby source code.
41 42 43 44 45 46 47 48 49 |
# File 'lib/command_mapper/gen/argument.rb', line 41 def to_ruby ruby = "argument #{@name.inspect}" keywords = super() ruby << ", #{keywords}" unless keywords.empty? ruby << ", repeats: #{@repeats.inspect}" unless @repeats.nil? ruby end |