Define a private range typecasting method for the given type that uses the parser argument to do the type conversion.
# File lib/sequel/extensions/pg_range.rb, line 208 def self.define_range_typecast_method(type, parser) meth = :"typecast_value_#{type}" define_method(meth){|v| typecast_value_pg_range(v, parser)} private meth end
Reset the conversion procs if using the native postgres adapter, and extend the datasets to correctly literalize ruby Range values.
# File lib/sequel/extensions/pg_range.rb, line 187 def self.extended(db) db.instance_eval do extend_datasets(DatasetMethods) copy_conversion_procs([3904, 3906, 3912, 3926, 3905, 3907, 3913, 3927]) [:int4range, :numrange, :tsrange, :tstzrange, :daterange, :int8range].each do |v| @schema_type_classes[v] = PGRange end end procs = db.conversion_procs procs[3908] = Parser.new("tsrange", procs[1114]) procs[3910] = Parser.new("tstzrange", procs[1184]) if defined?(PGArray::Creator) procs[3909] = PGArray::Creator.new("tsrange", procs[3908]) procs[3911] = PGArray::Creator.new("tstzrange", procs[3910]) end end
Generated with the Darkfish Rdoc Generator 2.