Module: PG::TypeMap::DefaultTypeMappable

Instance Method Summary collapse

Instance Method Details

#default_type_mapTypeMap

Returns the default TypeMap that is currently set for values that could not be casted by this type map.

Returns a kind of PG::TypeMap.

Returns:



112
113
114
115
116
117
118
# File 'ext/pg_type_map.c', line 112

static VALUE
pg_typemap_default_type_map_get(VALUE self)
{
	t_typemap *this = DATA_PTR( self );

	return this->default_typemap;
}

#default_type_map=(typemap) ⇒ Object

Set the default TypeMap that is used for values that could not be casted by this type map.

typemap must be a kind of PG::TypeMap



87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'ext/pg_type_map.c', line 87

static VALUE
pg_typemap_default_type_map_set(VALUE self, VALUE typemap)
{
	t_typemap *this = DATA_PTR( self );

	if ( !rb_obj_is_kind_of(typemap, rb_cTypeMap) ) {
		rb_raise( rb_eTypeError, "wrong argument type %s (expected kind of PG::TypeMap)",
				rb_obj_classname( typemap ) );
	}
	Check_Type(typemap, T_DATA);
	this->default_typemap = typemap;

	return typemap;
}

#with_default_type_map(typemap) ⇒ Object

Set the default TypeMap that is used for values that could not be casted by this type map.

typemap must be a kind of PG::TypeMap

Returns self.



131
132
133
134
135
136
# File 'ext/pg_type_map.c', line 131

static VALUE
pg_typemap_with_default_type_map(VALUE self, VALUE typemap)
{
	pg_typemap_default_type_map_set( self, typemap );
	return self;
}