Class: LibTAD::TADTime::DSTEntry

Inherits:
Object
  • Object
show all
Defined in:
lib/types/time/dst_entry.rb

Overview

DST information about a region.

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#dstendString (readonly)

Ending date of daylight savings time. Suppressed, if there are no DST changes in the queried year.

Returns:

  • (String)


30
31
32
# File 'lib/types/time/dst_entry.rb', line 30

def dstend
  @dstend
end

#dststartString (readonly)

Starting date of daylight savings time. Suppressed, if there are no DST changes in the queried year.

Returns:

  • (String)


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

#specialDstEntrySpecial (readonly)

Indicates if the region does not observe DST at all, or is on DST all year long.

Returns:

  • (DstEntrySpecial)


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

#timechangesArray<::LibTAD::TADTime::TimeChange] (readonly)

Time changes (daylight savings time). Only present if requested and information is available.

Returns:



34
35
36
# File 'lib/types/time/dst_entry.rb', line 34

def timechanges
  @timechanges
end