Class: Kali::Type::Time
- Inherits:
-
DateTime
- Object
- Kali::Type
- DateTime
- Kali::Type::Time
- Defined in:
- lib/kali/type/time.rb
Overview
Used to represent precise times of the day.
Instance Method Summary collapse
Methods inherited from DateTime
Methods inherited from Kali::Type
#decode, #encode, #initialize, #parameters
Constructor Details
This class inherits a constructor from Kali::Type
Instance Method Details
#decode!(string) ⇒ Object
12 13 14 15 |
# File 'lib/kali/type/time.rb', line 12 def decode!(string) _, hour, minute, second, utc = *string.match(/(\d{2})(\d{2})(\d{2})?(Z)?/) ::Time.parse([hour, minute, second || "00"].join(":") + utc.to_s) end |
#encode! ⇒ Object
8 9 10 |
# File 'lib/kali/type/time.rb', line 8 def encode!(*) super.split("T").last end |