Class: Webmachine::Response::HeaderHash
- Inherits:
-
Hash
- Object
- Hash
- Webmachine::Response::HeaderHash
- Defined in:
- lib/webmachine/response.rb
Overview
A Hash that can flatten array values into single values with a separator
Instance Method Summary collapse
-
#flattened(separator = ',') ⇒ HeaderHash
Return a new array with any Array values combined with the separator.
Instance Method Details
#flattened(separator = ',') ⇒ HeaderHash
Return a new array with any Array values combined with the separator
65 66 67 68 69 70 71 72 73 74 |
# 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 |