Class: DB::Postgres::Native::Types::DateTime

Inherits:
Object
  • Object
show all
Defined in:
lib/db/postgres/native/types.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name = "TIMESTAMP") ⇒ DateTime

Returns a new instance of DateTime.



95
96
97
# File 'lib/db/postgres/native/types.rb', line 95

def initialize(name = "TIMESTAMP")
	@name = name
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



99
100
101
# File 'lib/db/postgres/native/types.rb', line 99

def name
  @name
end

Instance Method Details

#parse(string) ⇒ Object



101
102
103
104
105
106
107
# File 'lib/db/postgres/native/types.rb', line 101

def parse(string)
	if string
		parts = string.split(/[\-\s:]/)
		
		return Time.utc(*parts)
	end
end