module PrayerTimes::Setters

General setters

Public Instance Methods

calculation_method=(calc_method) click to toggle source

Sets calculation method && the corresponding settings @param [String] calc_method the method name

# File lib/prayer_times/setters.rb, line 62
def calculation_method=(calc_method)
  @calculation_method =
  if PrayerTimes.calculation_methods.key?(calc_method)
    const_class.calculation_methods[calc_method]
  else
    PrayerTimes.calculation_method
  end
end
invalid_time=(str) click to toggle source

Sets the invalid time replacement string @param [String] str

# File lib/prayer_times/setters.rb, line 35
def invalid_time=(str)
  @invalid_time = str || const_class.invalid_time
end
iterations_count=(num) click to toggle source

Sets iterations c @param [Integer] num

0 < num < 6
# File lib/prayer_times/setters.rb, line 9
def iterations_count=(num)
  @iterations_count =
  if (Constants.accepted_iterations_count_range).include?(num)
    num
  else
    const_class.iterations_count
  end
end
time_format=(format) click to toggle source

Sets time format @param [String] format

'24h':    24-hour format,
'12h':    12-hour format,
'12hNS':  12-hour format with no suffix,
'Float':  floating point number
# File lib/prayer_times/setters.rb, line 24
def time_format=(format)
  @time_format =
  if Constants.accepted_time_formats.include?(format)
    format
  else
    const_class.time_format
  end
end
time_suffixes=(suffixes) click to toggle source

Sets times suffixes @param [Hash] suffixes

# File lib/prayer_times/setters.rb, line 41
def time_suffixes=(suffixes)
  s = suffixes.reject { |k, v| !(const_class.time_suffixes.key?(k) && v.is_a?(String)) } rescue {}
  @time_suffixes = const_class.time_suffixes.merge(s)
end
times_names=(names) click to toggle source

Sets times names @param [Hash] names

# File lib/prayer_times/setters.rb, line 48
def times_names=(names)
  s = names.reject { |k, v| !(const_class.times_names.key?(k) && v.is_a?(String)) } rescue {}
  @times_names = const_class.times_names.merge(s)
end
times_offsets=(offsets) click to toggle source

Sets times offsets @param [Hash] offsets

# File lib/prayer_times/setters.rb, line 55
def times_offsets=(offsets)
  s = offsets.reject { |k, v| !(const_class.times_offsets.key?(k) && v.is_a?(Numeric)) } rescue {}
  @times_offsets = const_class.times_offsets.merge(s)
end