Sha256: bef17b88f846280056a2ee198693de697cff93816c2bb746818e713a497efbbc
Contents?: true
Size: 982 Bytes
Versions: 68
Compression:
Stored size: 982 Bytes
Contents
# frozen_string_literal: true class ReeMapper::String < ReeMapper::AbstractType contract(Any, Kwargs[name: String, role: Nilor[Symbol, ArrayOf[Symbol]]] => String).throws(ReeMapper::TypeError) def serialize(value, name:, role: nil) if value.is_a? String value else raise ReeMapper::TypeError, "`#{name}` should be a string" end end contract(Any, Kwargs[name: String, role: Nilor[Symbol, ArrayOf[Symbol]]] => String).throws(ReeMapper::TypeError) def cast(value, name:, role: nil) serialize(value, name: name, role: role) end contract(Any, Kwargs[name: String, role: Nilor[Symbol, ArrayOf[Symbol]]] => String).throws(ReeMapper::TypeError) def db_dump(value, name:, role: nil) serialize(value, name: name, role: role) end contract(Any, Kwargs[name: String, role: Nilor[Symbol, ArrayOf[Symbol]]] => String).throws(ReeMapper::TypeError) def db_load(value, name:, role: nil) serialize(value, name: name, role: role) end end
Version data entries
68 entries across 68 versions & 1 rubygems