Class: Azure::Images
- Inherits:
-
Object
- Object
- Azure::Images
- Defined in:
- lib/azure/image.rb
Instance Method Summary collapse
- #all ⇒ Object
- #exists?(name) ⇒ Boolean
- #find(name) ⇒ Object
-
#initialize(connection) ⇒ Images
constructor
A new instance of Images.
- #load ⇒ Object
Constructor Details
#initialize(connection) ⇒ Images
Returns a new instance of Images.
21 22 23 |
# File 'lib/azure/image.rb', line 21 def initialize(connection) @connection=connection end |
Instance Method Details
#all ⇒ Object
37 38 39 |
# File 'lib/azure/image.rb', line 37 def all self.load.values end |
#exists?(name) ⇒ Boolean
41 42 43 |
# File 'lib/azure/image.rb', line 41 def exists?(name) self.all.key?(name) end |
#find(name) ⇒ Object
45 46 47 |
# File 'lib/azure/image.rb', line 45 def find(name) self.load[name] end |
#load ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/azure/image.rb', line 24 def load @images ||= begin images = Hash.new response = @connection.query_azure('images') osimages = response.css('OSImage') osimages.each do |image| item = Image.new(image) images[item.name] = item end images end end |