Sha256: 8cefa2d95a17c3ed9ab7e9355952a678fbd5c10a4e6deebc6ea5740a069145e3

Contents?: true

Size: 636 Bytes

Versions: 2

Compression:

Stored size: 636 Bytes

Contents

require "solareventcalculator"
require "tlapse/config"

module Tlapse
  module SolarEvent
    def self.sunrise
      tz = Tlapse::Config.get "tz"
      s  = solar_event.compute_official_sunrise(tz)
      n  = Time.new
      Time.new(n.year, n.month, n.day, s.hour, s.minute)
    end

    def self.sunset
      tz = Tlapse::Config.get "tz"
      s  = solar_event.compute_official_sunset(tz)
      n  = Time.new
      Time.new(n.year, n.month, n.day, s.hour, s.minute)
    end

    def self.solar_event
      date = Date.new
      lat, lon = Tlapse::Config.get "lat", "lon"
      SolarEventCalculator.new date, lat, lon
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tlapse-0.9.0 lib/tlapse/solar_event.rb
tlapse-0.8.0 lib/tlapse/solar_event.rb