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.19.0.pre20160817083826 lib/pg/text_encoder.rb
pg-0.19.0.pre20160810143640 lib/pg/text_encoder.rb
pg-0.19.0.pre20160409114042 lib/pg/text_encoder.rb
pg-0.18.4-x64-mingw32 lib/pg/text_encoder.rb
pg-0.18.4-x86-mingw32 lib/pg/text_encoder.rb
pg-0.18.4 lib/pg/text_encoder.rb
pg-0.18.3-x86-mingw32 lib/pg/text_encoder.rb
pg-0.18.3-x64-mingw32 lib/pg/text_encoder.rb
pg-0.18.3 lib/pg/text_encoder.rb
solidus_backend-1.0.0.pre3 vendor/bundle/gems/pg-0.18.2/lib/pg/text_encoder.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/pg-0.18.2/lib/pg/text_encoder.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/pg-0.18.2/lib/pg/text_encoder.rb
pg-0.18.2-x86-mingw32 lib/pg/text_encoder.rb
pg-0.18.2-x64-mingw32 lib/pg/text_encoder.rb
pg-0.18.2 lib/pg/text_encoder.rb
pg-0.18.1-x64-mingw32 lib/pg/text_encoder.rb
pg-0.18.1-x86-mingw32 lib/pg/text_encoder.rb
pg-0.18.1 lib/pg/text_encoder.rb
pg-0.18.0-x86-mingw32 lib/pg/text_encoder.rb
pg-0.18.0-x64-mingw32 lib/pg/text_encoder.rb