Class: Box::Release::Loader

Inherits:
Object
  • Object
show all
Defined in:
lib/box/release/loader.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url) ⇒ Loader

Returns a new instance of Loader.



10
11
12
# File 'lib/box/release/loader.rb', line 10

def initialize(url)
  @url = url
end

Instance Attribute Details

#urlObject (readonly)

Returns the value of attribute url.



8
9
10
# File 'lib/box/release/loader.rb', line 8

def url
  @url
end

Class Method Details

.release_at(url) ⇒ Object



14
15
16
# File 'lib/box/release/loader.rb', line 14

def self.release_at(url)
  new(url).release if url
end

Instance Method Details

#attributesObject



18
19
20
21
22
23
# File 'lib/box/release/loader.rb', line 18

def attributes
  @attributes ||= YAML.load open(url,&:read) 
rescue => e
  Box::Release.logger.error "Can't load attributes from #{url} : #{e}"
  {}
end

#releaseObject



25
26
27
# File 'lib/box/release/loader.rb', line 25

def release
  Box::Release::Memory.new attributes.merge(:reference_url => url)
end