class Easy::Configuration::Custom

Public Instance Methods

method_missing(name, *args) click to toggle source
# File lib/easy/configuration/custom.rb, line 5
def method_missing(name, *args)
  name_string = name.to_s
  if name_string.chomp!("=")
    from_file[name_string] = args.first
  else
    bangs = name_string.chomp!("!")

    if bangs
      from_file[name_string].presence || raise(KeyError.new(":#{name_string} is blank"))
    else
      from_file[name_string]
    end
  end
end
respond_to_missing?(name, include_private) click to toggle source
# File lib/easy/configuration/custom.rb, line 20
def respond_to_missing?(name, include_private)
  true
end

Private Instance Methods

from_file() click to toggle source
# File lib/easy/configuration/custom.rb, line 26
def from_file
  @from_file ||= begin
    file_path = Rails.root.join('config/config.yml')
    File.exists?(file_path) ? YAML.load_file(file_path) : {}
  end
end