PG::
TypeMapByClass class
Superclass | PG::TypeMap |
Included Modules |
This type map casts values based on the class or the ancestors of the given value to be sent.
This type map is usable for type casting query bind parameters and COPY data for PG::Connection#put_copy_data
. Therefore only encoders might be assigned by the []=
method.
Public Instance Methods
Returns the encoder object for the given class
Assigns a new PG::Coder
object to the type map. The encoder is chosen for all values that are a kind of the given class
.
coder
can be one of the following:
-
nil
- Values are forwarded to thedefault_type_map
. -
a
PG::Coder
- Values are encoded by the given encoder -
a Symbol - The method of this type map (or a derivation) that is called for each value to sent. It must return a
PG::Coder
ornil
. -
a Proc - The Proc object is called for each value. It must return a
PG::Coder
ornil
.
Returns all classes and their assigned encoder object.