quran-json/lib/quran-json/command.rb
0x1eef e0eb0a5ac8 The Great Rename
Rename the project to quran-json
2023-02-09 01:34:57 -03:00

37 lines
626 B
Ruby

module Command
require "ryo"
require "json"
require "io/line"
def root_dir
File.realpath File.join(__dir__, "..", "..")
end
def share_dir
File.join(root_dir, "share", "quran-json")
end
def data_dir
File.join(share_dir, "data")
end
def quran_dir
File.join(share_dir, "TheQuran")
end
def line
@line ||= IO::Line.new($stdout)
end
def count
@count ||= Ryo.from(
JSON.parse File.binread(File.join(data_dir, "count.json"))
)
end
def surah_info
@surah_info ||= Ryo.from(
JSON.parse File.binread(File.join(data_dir, "surahinfo.json"))
)
end
end