Sha256: 22599647f24168f8be26e616302c8fc4a0da36c1e2143d4cf4c1a2c846245870

Contents?: true

Size: 761 Bytes

Versions: 28

Compression:

Stored size: 761 Bytes

Contents

#!/usr/bin/env ruby

module PG
	module TextEncoder
		class Date < SimpleEncoder
			STRFTIME_ISO_DATE = "%Y-%m-%d".freeze
			def encode(value)
				value.respond_to?(:strftime) ? value.strftime(STRFTIME_ISO_DATE) : value
			end
		end

		class TimestampWithoutTimeZone < SimpleEncoder
			STRFTIME_ISO_DATETIME_WITHOUT_TIMEZONE = "%Y-%m-%d %H:%M:%S.%N".freeze
			def encode(value)
				value.respond_to?(:strftime) ? value.strftime(STRFTIME_ISO_DATETIME_WITHOUT_TIMEZONE) : value
			end
		end

		class TimestampWithTimeZone < SimpleEncoder
			STRFTIME_ISO_DATETIME_WITH_TIMEZONE = "%Y-%m-%d %H:%M:%S.%N %:z".freeze
			def encode(value)
				value.respond_to?(:strftime) ? value.strftime(STRFTIME_ISO_DATETIME_WITH_TIMEZONE) : value
			end
		end
	end
end # module PG

Version data entries

28 entries across 28 versions & 2 rubygems

Version Path
pg-0.18.0 lib/pg/text_encoder.rb
pg-0.18.0.pre20141117110243-x86-mingw32 lib/pg/text_encoder.rb
pg-0.18.0.pre20141117110243-x64-mingw32 lib/pg/text_encoder.rb
pg-0.18.0.pre20141117110243 lib/pg/text_encoder.rb
pg-0.18.0.pre20141017160319-x86-mingw32 lib/pg/text_encoder.rb
pg-0.18.0.pre20141017160319-x64-mingw32 lib/pg/text_encoder.rb
pg-0.18.0.pre20141017160319 lib/pg/text_encoder.rb
pg-0.18.0.pre20141017155815 lib/pg/text_encoder.rb