Class: CommandMapper::Gen::Types::Enum
- Inherits:
-
Object
- Object
- CommandMapper::Gen::Types::Enum
- Defined in:
- lib/command_mapper/gen/types/enum.rb
Instance Attribute Summary collapse
- #values ⇒ Array<Symbol> readonly
Instance Method Summary collapse
-
#initialize(values) ⇒ Enum
constructor
Initializes the enum type.
-
#to_ruby ⇒ String
Converts the map type to Ruby source code.
Constructor Details
#initialize(values) ⇒ Enum
Initializes the enum type.
14 15 16 |
# File 'lib/command_mapper/gen/types/enum.rb', line 14 def initialize(values) @values = values end |
Instance Attribute Details
#values ⇒ Array<Symbol> (readonly)
7 8 9 |
# File 'lib/command_mapper/gen/types/enum.rb', line 7 def values @values end |
Instance Method Details
#to_ruby ⇒ String
Converts the map type to Ruby source code.
23 24 25 |
# File 'lib/command_mapper/gen/types/enum.rb', line 23 def to_ruby "Enum[#{@values.map(&:inspect).join(', ')}]" end |