Module: RDBI::Type::Conversions

Includes:
TypeLib::Canned::Conversions
Defined in:
lib/rdbi/types.rb

Overview

Module for canned conversions that are unique to RDBI. Includes the canned conversions from TypeLib.

Constant Summary collapse

TO_NULL =
proc { |obj| nil }
TO_STRING_DECIMAL =
proc { |obj| obj.to_s('F') }
TO_STRING_DATETIME =
proc { |obj| obj.strftime(DEFAULT_STRFTIME_FILTER) }
TO_STRING_BOOLEAN =
proc { |obj| obj ? 'TRUE' : 'FALSE' }
SQL_STR_TO_BOOLEAN =
proc { |obj|
  case obj
    when /^(t(rue)?|1)$/i
      true
    when /^(f(alse)?|0)$/i
      false
    else
      nil
  end
}