File: date.rb

package info (click to toggle)
ruby-pg 1.6.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,316 kB
  • sloc: ansic: 9,403; ruby: 3,160; makefile: 10
file content (13 lines) | stat: -rw-r--r-- 318 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
# -*- ruby -*-
# frozen_string_literal: true

module PG
	module TextEncoder
		# This is a encoder class for conversion of Ruby Date values to PostgreSQL date type.
		class Date < SimpleEncoder
			def encode(value)
				value.respond_to?(:strftime) ? value.strftime("%Y-%m-%d") : value
			end
		end
	end
end # module PG