lib/fcs/response.rb
def headers_2_hash hdrs
      hash = {}
      hdrs.each do |h|
        if /\A([^\s:]+)\s*:\s*/ =~ h
          tail = $'.dup
          hash[ $1.downcase.gsub(/-/,"_").intern ] = tail
        end
      end
      hash
    end
def headers_2_hash hdrs
      hash = {}
      hdrs.each do |h|
        if /\A([^\s:]+)\s*:\s*/ =~ h
          tail = $'.dup
          hash[ $1.downcase.gsub(/-/,"_").intern ] = tail
        end
      end
      hash
    end
def headers_2_hash hdrs hash = { } hdrs . each do | h | if / \A \s \s \s / =~ h tail = $' . dup hash [ $1 . downcase . gsub ( / / , "_" ) . intern ] = tail end end hash end
Stolen from eventmachine:
 https://github.com/eventmachine/eventmachine/blob/master/lib/em/protocols/header_and_content.rb
Stolen from eventmachine : https : // github . com / eventmachine / eventmachine / blob / master / lib / em / protocols / header_and_content . rb