Sha256: 42a5daa202f87448e8753349c4b8dc811901cb717bf4b84ee09366fe5e22cf58

Contents?: true

Size: 348 Bytes

Versions: 5

Compression:

Stored size: 348 Bytes

Contents

require 'delegate'
require 'yaml'
require 'ostruct'

module BSClient
  class Config < SimpleDelegator
    class << self
      def create(env, file = nil)
        file ||= File.expand_path('~/.bsclient.yml')
        yaml = YAML.load(File.read(file)) || {}
        conf = yaml[env] || {}
        new(OpenStruct.new(conf))
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
bsclient-0.1.6 lib/bsclient/config.rb
bsclient-0.1.5 lib/bsclient/config.rb
bsclient-0.1.3 lib/bsclient/config.rb
bsclient-0.1.2 lib/bsclient/config.rb
bsclient-0.1.0 lib/bsclient/config.rb