Class: DB::Postgres::Native::Types::DateTime
- Inherits:
-
Object
- Object
- DB::Postgres::Native::Types::DateTime
- Defined in:
- lib/db/postgres/native/types.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(name = "TIMESTAMP") ⇒ DateTime
constructor
A new instance of DateTime.
- #parse(string) ⇒ Object
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
#name ⇒ Object (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 |