Class: Net::HTTPResponse

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/iplayer/browser.rb

Overview

Monkey-patch in some 21st-century functionality

Instance Method Summary collapse

Instance Method Details

#cookiesObject



7
8
9
10
11
# File 'lib/iplayer/browser.rb', line 7

def cookies
  inject([]){ |acc, (key, value)|
    key == 'set-cookie' ? acc << value.split(/;/).first : acc
  }
end

#to_hashObject



13
14
15
16
17
18
# File 'lib/iplayer/browser.rb', line 13

def to_hash
  @to_hash ||= inject({}){ |hash, (key, value)|
    hash[key] = value
    hash
  }
end