Calculation Methods - Startappz/prayer_times GitHub Wiki

There are several calculation methods that ships with this gem. Those methods are added in the CalculationMethods class.

Available methods

To add check the available methods at any time:

PrayerTimes.calculation_methods
PrayerTimes.calculation_methods.names

Adding new method

The available methods covers most of the planet methods. However, adding a new method is an easy task, for example:

PrayerTimes.calculation_methods.add("Test", "Testing method", fajr: 16.5, asr: 'Hanafi', isha: '80 min') 
new_method = PrayerTimes.calculation_methods["Test"]

Editing a method

# After adding the 'Test' method, from the above example
new_method = PrayerTimes.calculation_methods["Test"]
new_method.description = "new description"
new_method.settings = {fajr: 19.5, isha: '33 min'}
PrayerTimes.calculation_methods["Test"]

Deleting a method

# After adding the 'Test' method, from the above example
new_method = PrayerTimes.calculation_methods["Test"]
PrayerTimes.calculation_methods.delete("Test")
PrayerTimes.calculation_methods["Test"]