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
67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/webmachine/response.rb', line 67 def flattened(separator = ',') Hash[self.collect { |k,v| case v when Array [k,v.join(separator)] else [k,v] end }] end |