class TheBathOfZahn::Utility::Extractor
Public Instance Methods
rules_plain()
click to toggle source
# File lib/the_bath_of_zahn/utility/extractor.rb, line 4 def rules_plain @rules_plain ||= rules_styleguide.reject { |key, _value| key =~ %r{^Rails/} } end
Private Instance Methods
path_to_rubocop()
click to toggle source
# File lib/the_bath_of_zahn/utility/extractor.rb, line 38 def path_to_rubocop `bundle show rubocop`.chomp end
rules_enabled()
click to toggle source
# File lib/the_bath_of_zahn/utility/extractor.rb, line 19 def rules_enabled @rules_enabled ||= begin path = File.join(path_to_rubocop, "config", "enabled.yml") YAML.load_file(path) end end
rules_settings()
click to toggle source
# File lib/the_bath_of_zahn/utility/extractor.rb, line 11 def rules_settings @rules_settings ||= begin path = File.join(path_to_rubocop, "config", "default.yml") YAML.load_file(path) end end
rules_styleguide()
click to toggle source
# File lib/the_bath_of_zahn/utility/extractor.rb, line 27 def rules_styleguide @rules_styleguide ||= rules_enabled.select { |_, v| v["StyleGuide"] } .map { |name, config| [name, config.merge(settings_for(name))] } .to_h end
settings_for(name)
click to toggle source
# File lib/the_bath_of_zahn/utility/extractor.rb, line 34 def settings_for(name) rules_settings[name] || {} end