Class: PG::TextDecoder::Date

Inherits:
SimpleDecoder
  • Object
show all
Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/pg-1.4.5/lib/pg/text_decoder.rb

Instance Method Summary collapse

Instance Method Details

#decode(string, tuple = nil, field = nil) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/pg-1.4.5/lib/pg/text_decoder.rb', line 10

def decode(string, tuple=nil, field=nil)
	if string =~ /\A(\d{4})-(\d\d)-(\d\d)\z/
		::Date.new $1.to_i, $2.to_i, $3.to_i
	else
		string
	end
end