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 => RDBI::Type.filterlist(Filters::FROM_INTEGER), Fixnum => RDBI::Type.filterlist(Filters::FROM_INTEGER), Float => RDBI::Type.filterlist(Filters::FROM_NUMERIC), BigDecimal => RDBI::Type.filterlist(Filters::FROM_DECIMAL), DateTime => RDBI::Type.filterlist(Filters::FROM_DATETIME), TrueClass => RDBI::Type.filterlist(Filters::FROM_BOOLEAN), FalseClass => RDBI::Type.filterlist(Filters::FROM_BOOLEAN), :default => RDBI::Type.filterlist() }
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
).
188 189 190 191 192 193 194 195 196 |
# File 'lib/rdbi/types.rb', line 188 def self.convert(obj, type_hash) fl = type_hash[obj.class] unless fl fl = type_hash[:default] end fl.execute(obj) end |