Class: Ogle::ImageData
- Inherits:
-
Object
- Object
- Ogle::ImageData
- Defined in:
- lib/ogle/image.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
Returns the value of attribute attributes.
Instance Method Summary collapse
-
#initialize(attributes) ⇒ ImageData
constructor
A new instance of ImageData.
-
#to_ami_id ⇒ Object
Return a valid ami id from the given ‘glance id’.
Constructor Details
#initialize(attributes) ⇒ ImageData
Returns a new instance of ImageData.
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/ogle/image.rb', line 23 def initialize attributes @attributes = attributes class << self; self end.instance_eval do attributes.each_pair.each do |k, v| define_method k do v end end end end |
Instance Attribute Details
#attributes ⇒ Object
Returns the value of attribute attributes.
22 23 24 |
# File 'lib/ogle/image.rb', line 22 def attributes @attributes end |
Instance Method Details
#to_ami_id ⇒ Object
Return a valid ami id from the given ‘glance id’.
glance_id
: A String representing an image id in glance.
Note:
Glance image ids differ from those used by the EC2 API.
Currently there is no way to query EC2 for a glance_id
or vice versa.
15 16 17 18 19 20 |
# File 'lib/ogle/image.rb', line 15 def to_ami_id hex = self.id.to_i.to_s 16 padded = hex.to_s.rjust 8,"0" "ami-#{padded}" end |