Class: LibTAD::TADTime::DSTEntry
- Inherits:
-
Object
- Object
- LibTAD::TADTime::DSTEntry
- Defined in:
- lib/types/time/dst_entry.rb
Overview
DST information about a region.
Instance Attribute Summary collapse
-
#dstend ⇒ String
readonly
Ending date of daylight savings time.
-
#dststart ⇒ String
readonly
Starting date of daylight savings time.
-
#dsttimezone ⇒ ::LibTAD::TADTime::TADTimeZone
readonly
Information about the daylight savings time zone.
-
#region ⇒ ::LibTAD::Places::Region
readonly
The geographical region where this information is valid.
-
#special ⇒ DstEntrySpecial
readonly
Indicates if the region does not observe DST at all, or is on DST all year long.
-
#stdtimezone ⇒ ::LibTAD::TADTime::TADTimeZone
readonly
Information about the standard time zone.
-
#timechanges ⇒ Array<::LibTAD::TADTime::TimeChange]
readonly
Time changes (daylight savings time).
Instance Method Summary collapse
-
#initialize(hash) ⇒ DSTEntry
constructor
A new instance of DSTEntry.
Constructor Details
#initialize(hash) ⇒ DSTEntry
Returns a new instance of DSTEntry.
36 37 38 39 40 41 42 43 44 45 |
# File 'lib/types/time/dst_entry.rb', line 36 def initialize(hash) @region = ::LibTAD::Places::Region.new hash['region'] unless !hash.key?('region') @stdtimezone = ::LibTAD::TADTime::TADTimeZone.new hash['stdtimezone'] unless !hash.key?('stdtimezone') @dsttimezone = ::LibTAD::TADTime::TADTimeZone.new hash['dsttimezone'] unless !hash.key?('dsttimezone') @special = hash.dig('special', 'type') @dststart = hash.fetch('dststart', nil) @dstend = hash.fetch('dstend', nil) @timechanges = hash.fetch('timechanges', nil) &.map { |e| ::LibTAD::TADTime::TimeChange.new(e) } end |
Instance Attribute Details
#dstend ⇒ String (readonly)
Ending date of daylight savings time. Suppressed, if there are no DST changes in the queried year.
30 31 32 |
# File 'lib/types/time/dst_entry.rb', line 30 def dstend @dstend end |
#dststart ⇒ String (readonly)
Starting date of daylight savings time. Suppressed, if there are no DST changes in the queried year.
26 27 28 |
# File 'lib/types/time/dst_entry.rb', line 26 def dststart @dststart end |
#dsttimezone ⇒ ::LibTAD::TADTime::TADTimeZone (readonly)
Information about the daylight savings time zone. Suppressed, if there are no DST changes in the queried year. Please note that if the region is on daylight savings time for the whole year, this information will be returned the stdtimezone element. Additionally, the special element will be set to allyear.
18 19 20 |
# File 'lib/types/time/dst_entry.rb', line 18 def dsttimezone @dsttimezone end |
#region ⇒ ::LibTAD::Places::Region (readonly)
The geographical region where this information is valid. Contains country, a textual description of the region and the name of the biggest place.
8 9 10 |
# File 'lib/types/time/dst_entry.rb', line 8 def region @region end |
#special ⇒ DstEntrySpecial (readonly)
Indicates if the region does not observe DST at all, or is on DST all year long.
22 23 24 |
# File 'lib/types/time/dst_entry.rb', line 22 def special @special end |
#stdtimezone ⇒ ::LibTAD::TADTime::TADTimeZone (readonly)
Information about the standard time zone. This element is always returned.
12 13 14 |
# File 'lib/types/time/dst_entry.rb', line 12 def stdtimezone @stdtimezone end |
#timechanges ⇒ Array<::LibTAD::TADTime::TimeChange] (readonly)
Time changes (daylight savings time). Only present if requested and information is available.
34 35 36 |
# File 'lib/types/time/dst_entry.rb', line 34 def timechanges @timechanges end |