class Webmachine::Response::HeaderHash

A {Hash} that can flatten array values into single values with a separator

Public Instance Methods

flattened(separator = ',') click to toggle source

Return a new array with any {Array} values combined with the separator @param [String] The separator used to join Array values @return [HeaderHash] A new {HeaderHash} with Array values flattened

# File lib/webmachine/response.rb, line 65
def flattened(separator = ',')
  collect { |k, v|
    case v
    when Array
      [k, v.join(separator)]
    else
      [k, v]
    end
  }.to_h
end