Class/Module Index [+]

Quicksearch

Fog::Storage::IAAttributes::InstanceMethods

Public Instance Methods

set_metadata_array_headers(array_attribute, options={}) click to toggle source

set_metadata_array_headers(:collections, options)

# File lib/fog/internet_archive/models/storage/ia_attributes.rb, line 19
def set_metadata_array_headers(array_attribute, options={})
  attr_values = Array(self.send(array_attribute))
  opt_values = options.collect do |key,value| 
    options.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
    options["x-archive-meta-#{array_attribute.to_s[0..-2]}"] = values.first
  elsif values.size > 1
    values[0,99].each_with_index do |value, i|
      options["x-archive-meta#{format("%02d", i+1)}-#{array_attribute.to_s[0..-2]}"] = value
    end
  end

end

[Validate]

Generated with the Darkfish Rdoc Generator 2.