Class: PG::TextEncoder::TimestampWithoutTimeZone

Inherits:
SimpleEncoder show all
Defined in:
lib/pg/text_encoder.rb

Constant Summary collapse

STRFTIME_ISO_DATETIME_WITHOUT_TIMEZONE =
"%Y-%m-%d %H:%M:%S.%N".freeze

Instance Attribute Summary

Attributes inherited from Coder

#name

Instance Method Summary collapse

Methods inherited from Coder

#==, #decode, #dup, #format, #format=, #initialize, #inspect, #marshal_dump, #marshal_load, #oid, #oid=, #to_h

Constructor Details

This class inherits a constructor from PG::Coder

Instance Method Details

#encode(value) ⇒ Object



14
15
16
# File 'lib/pg/text_encoder.rb', line 14

def encode(value)
	value.respond_to?(:strftime) ? value.strftime(STRFTIME_ISO_DATETIME_WITHOUT_TIMEZONE) : value
end