class IMGLint::Config

Config class is responsible to load img-lint either a user defined config or a default one (config/default.yml)

Constants

DEFAULT_FILE
FILE_NAME

Public Class Methods

load() click to toggle source

Be default gem will try to load config file in user's project folder. Then user's config (or empty object) will be merge with the default config from gem's folder.

# File lib/img_lint/config.rb, line 19
def load
  user_config = File.exist?(user_file) ? YAML.safe_load(File.read(user_file)) : {}
  default_config = YAML.safe_load(File.read(DEFAULT_FILE))

  default_config.merge(user_config)
end

Private Class Methods

user_file() click to toggle source
# File lib/img_lint/config.rb, line 28
def user_file
  File.join(Dir.pwd, FILE_NAME)
end