Sha256: bb7370bfe48599621963bb84aede9b8e5674f4ee09e382091e30bc69c35a8845

Contents?: true

Size: 501 Bytes

Versions: 3

Compression:

Stored size: 501 Bytes

Contents

module DeviceMap
  module Properties
    module Types
      module Integer
        def self.cast(value)
          value.to_i
        end
      end

      module Boolean
        def self.cast(value)
          case value
          when 'true' then true
          when 'false' then false
          else fail ArgumentError, "Cannot cast #{value} to boolean"
          end
        end
      end

      module String
        def self.cast(value)
          value.to_s
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
device_map-0.1.2 lib/device_map/properties/types.rb
device_map-0.1.1 lib/device_map/properties/types.rb
device_map-0.1.0 lib/device_map/properties/types.rb