class ScrumLint::Configuration
Constants
- CONFIGURATION_KEYS
- DEFAULT_CONFIGURATION
- REQUIRED_CONFIGURATION_KEYS
Public Class Methods
new()
click to toggle source
# File lib/scrum_lint/configuration.rb, line 26 def initialize options = load_yaml_config.merge(DEFAULT_CONFIGURATION) CONFIGURATION_KEYS.each do |key| self.send("#{key}=", options.fetch(key)) options.delete(key) end raise "invalid options: #{options.keys}" if options.any? end
Private Instance Methods
config_file_contents()
click to toggle source
# File lib/scrum_lint/configuration.rb, line 45 def config_file_contents ERB.new(IO.read(config_file_path)).result end
config_file_path()
click to toggle source
# File lib/scrum_lint/configuration.rb, line 49 def config_file_path './.scrum-lint.yml' end
load_yaml_config()
click to toggle source
# File lib/scrum_lint/configuration.rb, line 38 def load_yaml_config unless File.exist?(config_file_path) abort('Please add a ".scrum-lint.yml" file and try again') end symbolize_keys(YAML.safe_load(config_file_contents)) end
symbolize_keys(hash)
click to toggle source
# File lib/scrum_lint/configuration.rb, line 53 def symbolize_keys(hash) hash.each_with_object({}) do |(key, value), result| new_key = key.is_a?(String) ? key.to_sym : key new_value = value.is_a?(Hash) ? symbolize_keys(value) : value result[new_key] = new_value end end