Sha256: b1129aca8a0319cdaf47aad96aa3bbaa4689cf87a97ebea19cea8f20b79945a1
Contents?: true
Size: 513 Bytes
Versions: 15
Compression:
Stored size: 513 Bytes
Contents
# frozen_string_literal: true module Attribeauty # base cast for types class TypeCaster BASE_TYPES = { float: Types::Float, integer: Types::Integer, boolean: Types::Boolean, time: Types::Time, string: Types::String }.freeze def self.run(value, type) return nil if value.nil? all_types = Attribeauty.configuration.types raise ArgumentError, "#{type} not supported" if all_types[type].nil? all_types[type].new.cast(value) end end end
Version data entries
15 entries across 15 versions & 1 rubygems