class PrayerTimes::Calculator

This is main interface class

Attributes

calculation_method[R]
invalid_time[R]
iterations_count[R]
time_format[R]
time_suffixes[R]
times_names[R]
times_offsets[R]

Public Class Methods

new(calc_method, opts) click to toggle source

Initializer @param [String] calc_method the calculation method to use @param [Hash] opts formatting options @option opts [String] :time_format @option opts [String] :invalid_time @option opts [String] :time_suffixes @option opts [String] :times_names @option opts [String] :times_offsets @option opts [String] :iterations_count this is algorithmic option. Don’t set it unless you know what you are doing @see Setters to get an idea about those options

# File lib/prayer_times/calculator.rb, line 19
def initialize(calc_method, opts)
  self.calculation_method = calc_method

  self.time_format = opts[:time_format]

  self.invalid_time = opts[:invalid_time]

  self.time_suffixes = (opts[:time_suffixes])

  self.times_names = (opts[:times_names])

  self.times_offsets = (opts[:times_offsets])

  self.iterations_count = opts[:iterations_count]
end

Public Instance Methods

get_times(date, coords, time_zone, dst = nil) click to toggle source

Gets the prayers times @param [Date] date the date @param [Array] coords of type [long, lat [,alt]] @param [Integer] time_zone the time zone @param [Integer] dst Daylight saving time @return [Hash] times

# File lib/prayer_times/calculator.rb, line 43
def get_times(date, coords, time_zone, dst = nil)
  Calculation.new(self,
                  date,
                  coords,
                  time_zone + (dst.nil? ? 0 : 1))
  .compute
end

Private Instance Methods

const_class() click to toggle source
# File lib/prayer_times/calculator.rb, line 53
def const_class
  PrayerTimes
end