Sha256: 77816910402ac89210a53a8ee0072eed023141a96b6311106a695777209c5258
Contents?: true
Size: 831 Bytes
Versions: 2
Compression:
Stored size: 831 Bytes
Contents
module Yun class FogAttributes < Hash def initialize attributes convert_basic_attributes attributes convert_tags_attributes attributes end private def convert_basic_attributes attributes attributes.each do |key, value| convert key, value end end def convert key, value if fog_key_mapping.has_key? key fog_key = fog_key_mapping[key] self[fog_key] = value end end def fog_key_mapping { :image => :image_id, :instance_type => :flavor_id, :key_name => :key_name } end def convert_tags_attributes attributes tags_key = ["name", "os", "user"] tags_hash = attributes.reject do |key, value| not tags_key.include? key end self[:tags] = tags_hash end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
yun-0.0.6 | lib/yun/model/fog_attributes.rb |
yun-0.0.5 | lib/yun/model/fog_attributes.rb |