Module: RDBI::Type::In
- Defined in:
- lib/rdbi/types.rb
Overview
The default input type map. As explained in RDBI::Type, these are keyed by the Ruby type with the exception of :default
which is a fallback conversion. RDBI::Statement subclassers will normally provide this object via @input_type_map at construction time.
Constant Summary collapse
- DEFAULTS =
{ Integer => [Filters::FROM_INTEGER], Fixnum => [Filters::FROM_INTEGER], Float => [Filters::FROM_NUMERIC], BigDecimal => [Filters::FROM_DECIMAL], DateTime => [Filters::FROM_DATETIME], TrueClass => [Filters::FROM_BOOLEAN], FalseClass => [Filters::FROM_BOOLEAN], :default => [] }
Class Method Summary collapse
-
.convert(obj, type_hash) ⇒ Object
Perform a conversion.
Class Method Details
.convert(obj, type_hash) ⇒ Object
Perform a conversion. Accepts the object to convert and a type map (a Hash
).
191 192 193 194 195 196 197 198 199 |
# File 'lib/rdbi/types.rb', line 191 def self.convert(obj, type_hash) fl = type_hash[obj.class] unless fl fl = type_hash[:default] end TypeLib.execute_filterlist(fl, obj) end |