class Yao::Resources::Image

Private Class Methods

resource_from_json(json) click to toggle source

override Yao::Resources::RestfullyAccessible.resource_from_json @param json [Hash] @return [Yao::Resources::*]

# File lib/yao/resources/image.rb, line 37
def resource_from_json(json)
  new(json)
end

Public Instance Methods

size(unit=nil) click to toggle source

@param unit [String] @return [Integer]

# File lib/yao/resources/image.rb, line 10
def size(unit=nil)
  size = self["OS-EXT-IMG-SIZE:size"]
  case unit
  when 'K'
    size / 1024.0
  when 'M'
    size / 1024.0 / 1024.0
  when 'G'
    size / 1024.0 / 1024.0 / 1024.0
  else
    size
  end
end