Sha256: 58349d4a97f2fb1fdc2259b54dd120b2d3f70e546ca03d84f71abfea6b46617a

Contents?: true

Size: 633 Bytes

Versions: 6

Compression:

Stored size: 633 Bytes

Contents

module GreenButtonData
  class LocalTimeParameters < Entry
    include Dst

    attr_accessor :dst_offset, :tz_offset

    def dst_starts_at(year = Time.now.year)
      byte_to_dst_datetime(@dst_start_rule, year).to_time
    end

    def dst_ends_at(year = Time.now.year)
      byte_to_dst_datetime(@dst_end_rule, year).to_time
    end

    def total_offset
      @dst_offset + @tz_offset
    end

    def to_h
      {
        dst: {
          starts_at: dst_starts_at,
          ends_at: dst_ends_at,
          offset: dst_offset
        },
        tz_offset: tz_offset,
        total_offset: total_offset
      }
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
green-button-data-0.4.1 lib/green-button-data/local_time_parameters.rb
green-button-data-0.3.2 lib/green-button-data/local_time_parameters.rb
green-button-data-0.4.0 lib/green-button-data/local_time_parameters.rb
green-button-data-0.4.0.alpha.pre.1 lib/green-button-data/local_time_parameters.rb
green-button-data-0.3.1 lib/green-button-data/local_time_parameters.rb
green-button-data-0.3.0 lib/green-button-data/local_time_parameters.rb