prayer_times

Calculates Muslim prayers times in given settings


License
GPL-3.0
Install
gem install prayer_times -v 0.1.3

Documentation

PrayerTimes Build Status Dependency Status Coverage Status

Flexible and configurable calculation for Muslim prayers times.

Installation

Add this line to your application's Gemfile:

gem 'prayer_times'

And then execute:

$ bundle

Or install it yourself as:

$ gem install prayer_times

Usage

Baisc usage

require 'prayer_times'
pt = PrayerTimes.new("Makkah") # there are several calculation methods, check adding more methods
times = pt.get_times(Date.today, [31,36], 3)
p times

Global configuration

You can have a global configuration through the PrayerTimes module:

require 'prayer_times'
PrayerTimes.time_format = '12h'
PrayerTimes.time_suffixes = {:am => 'صباحا', :pm => 'مساءا'}
# and others...

Adding more methods

There are several methods that are shiped with this gem by default. You can list, add new or update existing ones.

PrayerTimes.calculation_methods
PrayerTimes.calculation_methods.names
PrayerTimes.calculation_methods.add("Test", "Testing method", fajr: 16.5, asr: 'Hanafi', isha: '80 min')
new_method = PrayerTimes.calculation_methods["Test"]
new_method.description = "new description"
new_method.settings = {fajr: 19.5, isha: '33 min'}
PrayerTimes.calculation_methods.delete("Test")

Instance configuration

As with the global configuration, you can set the configuration on the object level:

require 'prayer_times'
PrayerTimes.time_format = '12h'
PrayerTimes.time_suffixes = {am: 'صباحا', pm: 'مساءا'}
options = {
	time_format: '12h',
	time_suffixes: {am: => 'صباحا', pm: 'مساءا'}
	# and others...
}
pt = PrayerTimes.new("Makkah", options)

Help

Your help is appreciated, specially in adjusting the calculation methods and making them more accurate. Your contribution is welcome.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request