class GreenButtonData::LocalTimeParameters

Attributes

dst_offset[RW]
tz_offset[RW]

Public Instance Methods

dst_ends_at(year = Time.now.year) click to toggle source
# File lib/green-button-data/local_time_parameters.rb, line 11
def dst_ends_at(year = Time.now.year)
  byte_to_dst_datetime(@dst_end_rule, year).to_time
end
dst_starts_at(year = Time.now.year) click to toggle source
# File lib/green-button-data/local_time_parameters.rb, line 7
def dst_starts_at(year = Time.now.year)
  byte_to_dst_datetime(@dst_start_rule, year).to_time
end
to_h(year = Time.now.year) click to toggle source
# File lib/green-button-data/local_time_parameters.rb, line 19
def to_h(year = Time.now.year)
  {
    dst: {
      starts_at: dst_starts_at(year),
      ends_at: dst_ends_at(year),
      offset: dst_offset
    },
    tz_offset: tz_offset,
    total_offset: total_offset
  }
end
total_offset() click to toggle source
# File lib/green-button-data/local_time_parameters.rb, line 15
def total_offset
  @dst_offset + @tz_offset
end