Class: Travis::Buildable::Config

Inherits:
Hash
  • Object
show all
Defined in:
lib/travis/buildable/config.rb

Instance Method Summary collapse

Constructor Details

#initialize(source) ⇒ Config

Returns a new instance of Config.



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/travis/buildable/config.rb', line 10

def initialize(source)
  source = URI.parse(source)

  http = Net::HTTP.new(source.host, 443)
  http.use_ssl = true

  response, body = http.get(source.path, nil)
  replace(YAML.load(body).symbolize_keys) rescue nil if response.code == '200'
rescue URI::InvalidURIError => e
  {}
end