Sha256: 97786b2d6855a3883994f3b437dc83306063fe5ee01607836a33ca478a92fbc1

Contents?: true

Size: 682 Bytes

Versions: 1

Compression:

Stored size: 682 Bytes

Contents

module Barometer
  #
  # A simple Sun class
  #
  # Used to store sunrise and sunset information
  #
  class Data::Sun

    attr_reader :rise, :set

    def initialize(rise=nil, set=nil)
      raise ArgumentError unless (rise.is_a?(Data::LocalTime) || rise.nil?)
      raise ArgumentError unless (set.is_a?(Data::LocalTime) || set.nil?)
      @rise = rise
      @set = set
    end

    def nil?
      (@rise || @set) ? false : true
    end

    def after_rise?(time)
      raise ArgumentError unless time.is_a?(Data::LocalTime)
      time >= @rise
    end

    def before_set?(time)
      raise ArgumentError unless time.is_a?(Data::LocalTime)
      time <= @set
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
barometer-0.8.0 lib/barometer/data/sun.rb