Class: PrayerTimes::Calculator
- Inherits:
-
Object
- Object
- PrayerTimes::Calculator
- Includes:
- Setters
- Defined in:
- lib/prayer_times/calculator.rb
Overview
This is main interface class
Instance Attribute Summary collapse
-
#calculation_method ⇒ Object
readonly
Returns the value of attribute calculation_method.
-
#invalid_time ⇒ Object
readonly
Returns the value of attribute invalid_time.
-
#iterations_count ⇒ Object
readonly
Returns the value of attribute iterations_count.
-
#time_format ⇒ Object
readonly
Returns the value of attribute time_format.
-
#time_suffixes ⇒ Object
readonly
Returns the value of attribute time_suffixes.
-
#times_names ⇒ Object
readonly
Returns the value of attribute times_names.
-
#times_offsets ⇒ Object
readonly
Returns the value of attribute times_offsets.
Instance Method Summary collapse
-
#get_times(date, coords, time_zone, dst = nil) ⇒ Hash
Gets the prayers times.
-
#initialize(calc_method, opts) ⇒ Calculator
constructor
Initializer.
Methods included from Setters
#calculation_method=, #invalid_time=, #iterations_count=, #time_format=, #time_suffixes=, #times_names=, #times_offsets=
Constructor Details
#initialize(calc_method, opts) ⇒ Calculator
Initializer
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# 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 |
Instance Attribute Details
#calculation_method ⇒ Object (readonly)
Returns the value of attribute calculation_method.
7 8 9 |
# File 'lib/prayer_times/calculator.rb', line 7 def calculation_method @calculation_method end |
#invalid_time ⇒ Object (readonly)
Returns the value of attribute invalid_time.
7 8 9 |
# File 'lib/prayer_times/calculator.rb', line 7 def invalid_time @invalid_time end |
#iterations_count ⇒ Object (readonly)
Returns the value of attribute iterations_count.
7 8 9 |
# File 'lib/prayer_times/calculator.rb', line 7 def iterations_count @iterations_count end |
#time_format ⇒ Object (readonly)
Returns the value of attribute time_format.
7 8 9 |
# File 'lib/prayer_times/calculator.rb', line 7 def time_format @time_format end |
#time_suffixes ⇒ Object (readonly)
Returns the value of attribute time_suffixes.
7 8 9 |
# File 'lib/prayer_times/calculator.rb', line 7 def time_suffixes @time_suffixes end |
#times_names ⇒ Object (readonly)
Returns the value of attribute times_names.
7 8 9 |
# File 'lib/prayer_times/calculator.rb', line 7 def times_names @times_names end |
#times_offsets ⇒ Object (readonly)
Returns the value of attribute times_offsets.
7 8 9 |
# File 'lib/prayer_times/calculator.rb', line 7 def times_offsets @times_offsets end |
Instance Method Details
#get_times(date, coords, time_zone, dst = nil) ⇒ Hash
Gets the prayers times
43 44 45 46 47 48 49 |
# 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 |