Class: Yao::Resources::Flavor

Inherits:
Base
  • Object
show all
Defined in:
lib/yao/resources/flavor.rb

Instance Attribute Summary

Attributes included from RestfullyAccessible

#service

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#[], #[]=, add_instantiation_name_list, #destroy, friendly_attributes, #id, #initialize, instantiation?, map_attribute_to_attribute, map_attribute_to_resource, map_attribute_to_resources, map_attributes_to_time, #to_hash, #update

Methods included from RestfullyAccessible

#admin=, #api_version, #api_version=, #as_member, #client, #create, #destroy, extended, #find_by_name, #get, #get!, #list, #resources_path, #resources_path=, #return_single_on_querying, #return_single_on_querying=, #update

Constructor Details

This class inherits a constructor from Yao::Resources::Base

Class Method Details

.find_by_name(name, query = {}) ⇒ Array<Yao::Resources::Role>

override Yao::Resources::RestfullyAccessible#find_by_name

Returns:



27
28
29
30
31
# File 'lib/yao/resources/flavor.rb', line 27

def find_by_name(name, query={})
  list(query).select do |flavor|
    flavor.name == name
  end
end

Instance Method Details

#ram(unit = 'M') ⇒ Integer Also known as: memory

Parameters:

  • unit (String) (defaults to: 'M')

Returns:

  • (Integer)


9
10
11
12
13
14
15
16
# File 'lib/yao/resources/flavor.rb', line 9

def ram(unit='M')
  case unit
  when 'M'
    self["ram"]
  when 'G'
    self["ram"] / 1024.0
  end
end