Module: Fog::Storage::IAAttributes::InstanceMethods
- Defined in:
- lib/fog/storage/internet_archive/models/ia_attributes.rb
Instance Method Summary collapse
-
#set_metadata_array_headers(array_attribute, options = {}) ⇒ Object
set_metadata_array_headers(:collections, options).
Instance Method Details
#set_metadata_array_headers(array_attribute, options = {}) ⇒ Object
set_metadata_array_headers(:collections, options)
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/fog/storage/internet_archive/models/ia_attributes.rb', line 18 def (array_attribute, ={}) attr_values = Array(self.send(array_attribute)) opt_values = .map do |key,value| .delete(key) if (key.to_s =~ /^x-(amz||archive)-meta(\d*)-#{array_attribute.to_s[0..-2]}/) end values = (attr_values + opt_values).compact.sort.uniq # got the values, now add them back to the options if values.size == 1 ["x-archive-meta-#{array_attribute.to_s[0..-2]}"] = values.first elsif values.size > 1 values[0,99].each_with_index do |value, i| ["x-archive-meta#{format("%02d", i+1)}-#{array_attribute.to_s[0..-2]}"] = value end end end |