Module: RDBI::Type::Out
- Defined in:
- lib/rdbi/types.rb
Overview
The default output type map. As explained in RDBI::Type, these are keyed by symbol and are loosely related to the type, and are compared against the proper RDBI::Column object to figure out which filter to call.
Constant Summary collapse
- DEFAULTS =
{ :integer => [Filters::STR_TO_INT], :decimal => [Filters::STR_TO_DEC], :datetime => [TypeLib::Canned.build_strptime_filter(DEFAULT_STRFTIME_FILTER)], :timestamp => [TypeLib::Canned.build_strptime_filter(DEFAULT_STRFTIME_FILTER)], :boolean => [Filters::TO_BOOLEAN], :default => [] }
Class Method Summary collapse
-
.convert(obj, column, type_hash) ⇒ Object
Perform a conversion.
Class Method Details
.convert(obj, column, type_hash) ⇒ Object
Perform a conversion. Accepts the object to convert, a RDBI::Column object, and a type map (a Hash
).
158 159 160 161 162 163 164 165 166 |
# File 'lib/rdbi/types.rb', line 158 def self.convert(obj, column, type_hash) fl = type_hash[column.ruby_type] unless fl fl = type_hash[:default] end TypeLib.execute_filterlist(fl, obj) end |