module Pakyow::Types

Constants

MAPPING

Public Class Methods

type_for(type) click to toggle source
# 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