Sha256: 075830127064c92168e564fc5654c345bbf9d7a583f30ffc6b6509979ae47be2

Contents?: true

Size: 378 Bytes

Versions: 1

Compression:

Stored size: 378 Bytes

Contents

module DeviceMap
  module Properties
    Property = Struct.new(:name, :type_name, :source_name) do
      TYPE_MAPPING = {
        integer: Types::Integer,
        boolean: Types::Boolean,
        string:  Types::String
      }

      def cast(value)
        return if value.nil?

        type = TYPE_MAPPING.fetch(type_name)
        type.cast(value)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
device_map-0.1.2 lib/device_map/properties/property.rb