Sha256: d7849ba92fef580672adf5a1b2c6e11e2e783daa47767abd095bfce81010635d
Contents?: true
Size: 679 Bytes
Versions: 12
Compression:
Stored size: 679 Bytes
Contents
# frozen_string_literal: true require "dry-types" module Pakyow module Types include Dry.Types(default: :nominal) MAPPING = { string: Coercible::String, boolean: Params::Bool, date: Params::Date, time: Params::Time, datetime: Params::Time, integer: Params::Integer, float: Params::Float, decimal: Params::Decimal }.freeze def self.type_for(type) if type.is_a?(Dry::Types::Type) type else MAPPING.fetch(type.to_sym) end rescue KeyError => error raise UnknownType.build(error, type: type, context: { type: type, types: MAPPING.keys }) end end end
Version data entries
12 entries across 12 versions & 1 rubygems