Sha256: 84d9c6855f2d7cd7ffde5d20d873dad06d0ed9e618869022120a92f06b002da2

Contents?: true

Size: 717 Bytes

Versions: 5

Compression:

Stored size: 717 Bytes

Contents

require 'active_support/core_ext/hash/indifferent_access'

module Aviator
class Test
  
  module Environment
    
    class << self
      
      attr_reader :config,
                  :path
      
      def init!
        @path = Pathname.new(__FILE__).join('..', '..', 'environment.yml').expand_path

        raise "Environment file #{ path } does not exist. Please make one." unless path.file?
      
        @config = YAML.load_file(path).with_indifferent_access
      end
      
      
      def method_missing(name, *args)
        if config.keys.include? name.to_s
          config[name.to_s]
        else
          super name, *args
        end
      end
      
    end
    
  end
  
  Environment.init!

end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
aviator-0.0.6 test/support/test_environment.rb
aviator-0.0.5 test/support/test_environment.rb
aviator-0.0.4 test/support/test_environment.rb
aviator-0.0.3 test/support/test_environment.rb
aviator-0.0.2 test/support/test_environment.rb