Class: LibTAD::TADTime::TADTime
- Inherits:
-
Object
- Object
- LibTAD::TADTime::TADTime
- Defined in:
- lib/types/time/time.rb
Overview
Information about date, time and timezone.
Instance Attribute Summary collapse
-
#datetime ⇒ DateTime
readonly
Date and time, split up into components.
-
#iso ⇒ String
readonly
ISO representation of date and time, time zone included (@see dev-test.timeanddate.com/docs/external-references#ISO8601 ISO8601) if different from UTC.
-
#timezone ⇒ TimeZone
readonly
Timezone information.
Instance Method Summary collapse
-
#initialize(hash) ⇒ TADTime
constructor
A new instance of TADTime.
Constructor Details
#initialize(hash) ⇒ TADTime
Returns a new instance of TADTime.
23 24 25 26 27 |
# File 'lib/types/time/time.rb', line 23 def initialize(hash) @iso = hash.fetch('iso', nil) @datetime = TADDateTime.new.from_json hash['datetime'] unless !hash.key?('datetime') @timezone = TADTimeZone.new hash['timezone'] unless !hash.key?('timezone') end |
Instance Attribute Details
#datetime ⇒ DateTime (readonly)
Date and time, split up into components.
17 18 19 |
# File 'lib/types/time/time.rb', line 17 def datetime @datetime end |
#iso ⇒ String (readonly)
ISO representation of date and time, time zone included (@see dev-test.timeanddate.com/docs/external-references#ISO8601 ISO8601) if different from UTC. If time is not applicable, only the date is shown.
Example: 2011-06-08T09:18:16+02:00 Example: 2011-06-08T07:18:16 (UTC time) Example: 2011-06-08 (only date)
13 14 15 |
# File 'lib/types/time/time.rb', line 13 def iso @iso end |
#timezone ⇒ TimeZone (readonly)
Timezone information.
21 22 23 |
# File 'lib/types/time/time.rb', line 21 def timezone @timezone end |