Sha256: c3e27336c4ea8de8f23e335861909899599c3b91d3b752d7d89178cf7b663139

Contents?: true

Size: 587 Bytes

Versions: 1

Compression:

Stored size: 587 Bytes

Contents

require 'singleton'
require 'yaml'

module Waffle
  class Config
    include Singleton

    attr_reader :config_hash

    def initialize
      @config_hash = {'transport' => 'rabbitmq', 'url' => nil, 'encoder' => 'json'}

      if defined? Rails
        @config_hash.merge! YAML.load_file("#{Rails.root}/config/#{Rails.env}.waffle.yml")
      end
    end

    class << self

      def method_missing(m, *args, &block)
        if self.instance.config_hash.has_key?(m.to_s)
          self.instance.config_hash[m.to_s]
        else
          super
        end
      end

    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
waffle-0.2.1 lib/waffle/config.rb