0.0
No commit activity in last 3 years
No release in over 3 years
Calculates Muslim prayers times in given settings
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

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