Class: DB::MariaDB::Native::Types::DateTime
- Inherits:
-
Object
- Object
- DB::MariaDB::Native::Types::DateTime
- Defined in:
- lib/db/mariadb/native/types.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(name = "DATETIME") ⇒ DateTime
constructor
A new instance of DateTime.
- #parse(string) ⇒ Object
Constructor Details
#initialize(name = "DATETIME") ⇒ DateTime
Returns a new instance of DateTime.
89 90 91 |
# File 'lib/db/mariadb/native/types.rb', line 89 def initialize(name = "DATETIME") @name = name end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
93 94 95 |
# File 'lib/db/mariadb/native/types.rb', line 93 def name @name end |
Instance Method Details
#parse(string) ⇒ Object
95 96 97 98 99 100 101 |
# File 'lib/db/mariadb/native/types.rb', line 95 def parse(string) if string parts = string.split(/[\-\s:]/) return Time.utc(*parts) end end |