class MutatorRails::Config

Constants

CONFIG_DEFAULT
PROJECT_ROOT
USER_CONFIG

Public Class Methods

configuration() click to toggle source
# File lib/mutator_rails/config.rb, line 15
def configuration
  @configuration ||= load_configuration
end
load_configuration() click to toggle source
# File lib/mutator_rails/config.rb, line 19
def load_configuration
  default_config = YAML.load_file(CONFIG_DEFAULT)
  user_config    = if USER_CONFIG && File.exist?(USER_CONFIG.to_s)
                     YAML.load_file(USER_CONFIG)
                   else
                     {}
                   end

  consolidated = default_config.merge(user_config)

  JSON.parse(consolidated.to_json, object_class: OpenStruct).freeze
end