Address rubocop errors

This commit is contained in:
0x1eef 2023-02-13 13:21:41 -03:00 committed by Robert
parent 3d8deaecf3
commit dd406b8a45
7 changed files with 18 additions and 6 deletions

View file

@ -10,6 +10,10 @@ inherit_gem:
AllCops: AllCops:
TargetRubyVersion: 3.2 TargetRubyVersion: 3.2
Include:
- libexec/quran-json/*
- lib/quran-json/**/*.rb
- bin/*
## ##
# Enabled cops # Enabled cops
@ -24,5 +28,3 @@ Layout/ArgumentAlignment:
Enabled: false Enabled: false
Style/LambdaCall: Style/LambdaCall:
Enabled: false Enabled: false
Style/FrozenStringLiteralComment:
Enabled: false

View file

@ -1,4 +1,6 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
# frozen_string_literal: true
require "json" require "json"
## ##

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Quran module Quran
module JSON module JSON
require_relative "json/cmd" require_relative "json/cmd"

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Quran::JSON::Cmd module Quran::JSON::Cmd
require "ryo" require "ryo"
require "json" require "json"

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class Quran::JSON::Pull class Quran::JSON::Pull
require "ryo" require "ryo"
require "json" require "json"
@ -43,7 +45,7 @@ class Quran::JSON::Pull
def write(surah_no, rows) def write(surah_no, rows)
mkdir_p(locale_dir) mkdir_p(locale_dir)
rows[0] = Ryo.table_of(metadata[surah_no-1]) rows[0] = Ryo.table_of(metadata[surah_no - 1])
write_json File.join(locale_dir, "#{surah_no}.json"), rows write_json File.join(locale_dir, "#{surah_no}.json"), rows
end end
@ -100,8 +102,6 @@ class Quran::JSON::Pull
end end
def sources def sources
@sources ||= Ryo.from( @sources ||= Ryo.from read_json(File.join(data_dir, "sources.json"))
JSON.parse File.binread(File.join(data_dir, "sources.json"))
)
end end
end end

View file

@ -1,4 +1,6 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
# frozen_string_literal: true
lib_dir = File.realpath File.join(__dir__, "..", "..", "lib", "quran-json") lib_dir = File.realpath File.join(__dir__, "..", "..", "lib", "quran-json")
require File.join(lib_dir, "quran", "json") require File.join(lib_dir, "quran", "json")
require "optparse" require "optparse"

View file

@ -1,4 +1,6 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
# frozen_string_literal: true
lib_dir = File.realpath File.join(__dir__, "..", "..", "lib", "quran-json") lib_dir = File.realpath File.join(__dir__, "..", "..", "lib", "quran-json")
require File.join(lib_dir, "quran", "json") require File.join(lib_dir, "quran", "json")
require "optparse" require "optparse"