Module: Pakyow::Types
- Defined in:
- lib/pakyow/types.rb
Constant Summary collapse
- 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
Class Method Summary collapse
Class Method Details
.type_for(type) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/pakyow/types.rb', line 20 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 |