Add Pull#locale_dir
This commit is contained in:
parent
a35e0ed6de
commit
316133c235
2 changed files with 7 additions and 4 deletions
|
@ -19,6 +19,10 @@ module Command
|
||||||
File.join(share_dir, "TheQuran")
|
File.join(share_dir, "TheQuran")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def locale_dir
|
||||||
|
File.join(share_dir, options.locale)
|
||||||
|
end
|
||||||
|
|
||||||
def line
|
def line
|
||||||
@line ||= IO::Line.new($stdout)
|
@line ||= IO::Line.new($stdout)
|
||||||
end
|
end
|
||||||
|
|
|
@ -42,10 +42,9 @@ class Pull
|
||||||
end
|
end
|
||||||
|
|
||||||
def write(surah_no, rows)
|
def write(surah_no, rows)
|
||||||
dir = File.join(quran_dir, options.locale)
|
mkdir_p(locale_dir)
|
||||||
mkdir_p(dir)
|
|
||||||
rows.unshift(Ryo.table_of(surah_info[surah_no - 1]))
|
rows.unshift(Ryo.table_of(surah_info[surah_no - 1]))
|
||||||
File.binwrite File.join(dir, "#{surah_no}.json"), JSON.pretty_generate(rows)
|
File.binwrite File.join(locale_dir, "#{surah_no}.json"), JSON.pretty_generate(rows)
|
||||||
end
|
end
|
||||||
|
|
||||||
def keepalive
|
def keepalive
|
||||||
|
@ -69,7 +68,7 @@ class Pull
|
||||||
end
|
end
|
||||||
|
|
||||||
def exist?(surah_no)
|
def exist?(surah_no)
|
||||||
File.exist? File.join(quran_dir, options.locale, "#{surah_no}.json")
|
File.exist? File.join(locale_dir, "#{surah_no}.json")
|
||||||
end
|
end
|
||||||
|
|
||||||
def headers
|
def headers
|
||||||
|
|
Loading…
Reference in a new issue