Class: HoundConfig
- Inherits:
-
Object
- Object
- HoundConfig
- Defined in:
- lib/hound/hound_config.rb
Constant Summary collapse
- CONFIG_FILE_REPOSITORY =
"https://raw.githubusercontent.com/platanus/la-guia/master/"
Class Method Summary collapse
- .content ⇒ Object
- .enabled_for?(linter_name) ⇒ Boolean
- .options_for(linter_name) ⇒ Object
- .rules_url_for(linter_name) ⇒ Object
Class Method Details
.content ⇒ Object
4 5 6 |
# File 'lib/hound/hound_config.rb', line 4 def self.content @@content ||= load_content end |
.enabled_for?(linter_name) ⇒ Boolean
8 9 10 11 12 13 14 15 16 |
# File 'lib/hound/hound_config.rb', line 8 def self.enabled_for?(linter_name) # disabled if linter_name key does not exist in hound.yml return false unless content.has_key?(linter_name) = (linter_name) # enabled if linter_name key exists and enabled key is not defined. return true unless .keys.select { |k| k.downcase === "enabled" }.any? # enabled "enabled" or "Enabled" keys are true. !!["enabled"] || !!["Enabled"] end |
.options_for(linter_name) ⇒ Object
18 19 20 21 |
# File 'lib/hound/hound_config.rb', line 18 def self.(linter_name) return content[linter_name] if content.try(:has_key?, linter_name) Hash.new end |
.rules_url_for(linter_name) ⇒ Object
23 24 25 26 |
# File 'lib/hound/hound_config.rb', line 23 def self.rules_url_for(linter_name) path_in_repo = (linter_name)["config_file"].to_s HoundConfig::CONFIG_FILE_REPOSITORY + path_in_repo end |