Sha256: 85ce5dc4b5763e108fef0d832b9c982f553c1c123b9b06327dd45f3b32002c52
Contents?: true
Size: 857 Bytes
Versions: 20
Compression:
Stored size: 857 Bytes
Contents
module Vcloud module Core module MetadataHelper def extract_metadata vcloud_metadata_entries metadata = {} vcloud_metadata_entries.each do |entry| next unless entry[:type] == Vcloud::Fog::ContentTypes::METADATA key = entry[:Key].to_sym val = entry[:TypedValue][:Value] case entry[:TypedValue][:xsi_type] when Fog::MetadataValueType::Number val = val.to_i when Fog::MetadataValueType::String val = val.to_s when Fog::MetadataValueType::DateTime val = DateTime.parse(val) when Fog::MetadataValueType::Boolean val = val == 'true' ? true : false end metadata[key] = val end metadata end module_function :extract_metadata end end end
Version data entries
20 entries across 20 versions & 1 rubygems