Class: CommandMapper::Gen::Types::List
- Inherits:
-
Object
- Object
- CommandMapper::Gen::Types::List
- Defined in:
- lib/command_mapper/gen/types/list.rb
Instance Attribute Summary collapse
- #separator ⇒ String readonly
Instance Method Summary collapse
-
#initialize(separator: ',') ⇒ List
constructor
Initializes the list type.
-
#to_ruby ⇒ String
Converts the list type to Ruby source code.
Constructor Details
#initialize(separator: ',') ⇒ List
Initializes the list type.
15 16 17 |
# File 'lib/command_mapper/gen/types/list.rb', line 15 def initialize(separator: ',') @separator = separator end |
Instance Attribute Details
#separator ⇒ String (readonly)
7 8 9 |
# File 'lib/command_mapper/gen/types/list.rb', line 7 def separator @separator end |
Instance Method Details
#to_ruby ⇒ String
Converts the list type to Ruby source code.
24 25 26 27 28 29 |
# File 'lib/command_mapper/gen/types/list.rb', line 24 def to_ruby ruby = "List.new(" ruby << "separator: #{@separator.inspect}" unless @separator == ',' ruby << ")" ruby end |