class Quran::Ayah
Public Class Methods
new(index, paths, surah)
click to toggle source
Calls superclass method
# File lib/quran/ayah.rb, line 4 def initialize(index, paths, surah) super return unless multiple_parts? self.paths = paths.sort_by(&method(:part_index)) end
Public Instance Methods
eql?(ayah)
click to toggle source
Returns true when “self” and “ayah” are the same ayah.
@param [Quran::Ayah] ayah
An ayah.
@return [Boolean]
# File lib/quran/ayah.rb, line 31 def eql?(ayah) return false unless self.class === ayah index == ayah.index && surah.index == ayah.surah.index end
Also aliased as: ==
multiple_parts?()
click to toggle source
# File lib/quran/ayah.rb, line 37 def multiple_parts? paths.size > 1 end
open(part = 1)
click to toggle source
Opens an Ayah
as an image with the default application for viewing images.
@param [Integer] part
In case of an Ayah broken up into parts, this argument chooses what part to pick.
@return [Integer]
Returns the PID of the spawned process.
# File lib/quran/ayah.rb, line 20 def open(part = 1) Opener.spawn paths[part - 1] end
Private Instance Methods
part_index(path)
click to toggle source
# File lib/quran/ayah.rb, line 43 def part_index(path) basename = File.basename(path, File.extname(path)) Integer basename[-1] end