Sha256: 9f59834b751d6b3b47baac39f3db801274f2b72a4279c397f1c79c735d7ca846

Contents?: true

Size: 565 Bytes

Versions: 1

Compression:

Stored size: 565 Bytes

Contents

require 'ostruct'
require 'yaml'

module Quandl
  class Config < ::OpenStruct
    VERSION = '0.0.1'

    def initialize(file_name)
      raw_config = File.read(::Rails.root.join('config', "#{file_name}.yml"))
      erb_config = ERB.new(raw_config).result
      config = YAML.load(erb_config)[Rails.env]

      super(config)
    end

    def configurable_attributes
      setters_and_getters = methods - self.class.instance_methods
      getters = setters_and_getters.reject { |method| method =~ /=$/ }
      getters
    end
  end
end

require 'quandl/configurable'

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
quandl-config-0.0.1 lib/quandl/config.rb