Class: Fog::Vcloud::Model

Inherits:
Model
  • Object
show all
Defined in:
lib/fog/vcloud/compute.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#loadedObject Also known as: loaded?

Returns the value of attribute loaded


36
37
38
# File 'lib/fog/vcloud/compute.rb', line 36

def loaded
  @loaded
end

Class Method Details

.has_up(item) ⇒ Object


56
57
58
59
60
61
62
63
# File 'lib/fog/vcloud/compute.rb', line 56

def self.has_up(item)
  class_eval <<-EOS, __FILE__,__LINE__
    def #{item}
      load_unless_loaded!
      service.get_#{item}(link_up[:href])
    end
  EOS
end

Instance Method Details


51
52
53
54
# File 'lib/fog/vcloud/compute.rb', line 51

def link_up
  load_unless_loaded!
  self.links.find{|l| l[:rel] == 'up' }
end

#load_unless_loaded!Object


45
46
47
48
49
# File 'lib/fog/vcloud/compute.rb', line 45

def load_unless_loaded!
  unless @loaded
    reload
  end
end

#reloadObject


39
40
41
42
43
# File 'lib/fog/vcloud/compute.rb', line 39

def reload
  instance = super
  @loaded = true
  instance
end