Sha256: 4a344f909dd333ab26e3ab9f43f698c4ed6603a10ca33e87769e9b0579c10702
Contents?: true
Size: 839 Bytes
Versions: 1
Compression:
Stored size: 839 Bytes
Contents
require_relative 'map' module CommandMapper module Types # # Represents a mapping of Ruby values to their String equivalents. # class Enum < Map # The values of the enum. # # @return [Array<Object>] # # @api semipublic # attr_reader :values # # Initializes the enum type. # # @param [Array<Object>] values # The values of the enum type. # def initialize(values) @values = values super(Hash[values.map { |value| [value, value.to_s] }]) end # # Creates a new enum. # # @param [Array<Object>] values # List of enum values. # # @return [Enum] # The newly created enum object. # def self.[](*values) new(values) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
command_mapper-0.3.2 | lib/command_mapper/types/enum.rb |