class Dolarblue::Configuration

Singleton configuration class

Public Instance Methods

defaults() click to toggle source

Give memoized defaults for locked configuration options found in /config/xpaths.yml file

@example Usage

conf = Configuration.instance.defaults
conf.base_url       #=> "http://www.ambito.com/economia/mercados/monedas/dolar/"
conf.blue.buy.xpath #=> "//*[@id=\"contenido\"]/div[1]/div[2]/div/div/div[2]/big"

@return [Configatron::Store] the magic configuration instance with hash and dot ‘.’ indifferent access

# File lib/dolarblue/configuration.rb, line 19
def defaults
  return @config if @config

  @config = Configatron::Store.new
  file_path   = File.expand_path('../../../config/xpaths.yml', __FILE__)
  hash_config = YAML::load_file(file_path)

  @config.configure_from_hash(hash_config)
  @config.lock!
  @config
end