Class: PG::TextEncoder::Date
- Inherits:
-
SimpleEncoder
- Object
- Coder
- SimpleCoder
- SimpleEncoder
- PG::TextEncoder::Date
- Defined in:
- lib/pg/text_encoder.rb
Constant Summary collapse
- STRFTIME_ISO_DATE =
"%Y-%m-%d".freeze
Instance Attribute Summary
Attributes inherited from Coder
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
7 8 9 |
# File 'lib/pg/text_encoder.rb', line 7 def encode(value) value.respond_to?(:strftime) ? value.strftime(STRFTIME_ISO_DATE) : value end |