Class: Kali::Type::Time

Inherits:
DateTime show all
Defined in:
lib/kali/type/time.rb

Overview

Used to represent precise times of the day.

See tools.ietf.org/html/rfc5545#section-3.3.12

Instance Method Summary collapse

Methods inherited from DateTime

#parameters

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