Class: QuoraNotify::CookieReaders::SafariCookieReader

Inherits:
CookieReader
  • Object
show all
Defined in:
lib/quora_notify/cookie_readers/safari_cookie_reader.rb

Constant Summary collapse

"#{ENV['HOME']}/Library/Cookies/Cookies.binarycookies"

Instance Method Summary collapse

Methods inherited from CookieReader

#cookie_file_path, #initialize

Constructor Details

This class inherits a constructor from QuoraNotify::CookieReaders::CookieReader

Instance Method Details

#read_cookiesObject

Returns an array of Cookie objects Raises: CookieReaderException



7
8
9
10
11
12
13
14
15
# File 'lib/quora_notify/cookie_readers/safari_cookie_reader.rb', line 7

def read_cookies
  raise QuoraNotify::Exceptions::CookieReaderException, 'No cookie file found' unless File.exists?(cookie_file_path)

  cookies = []
  File.open(cookie_file_path, 'rb') do |cookie_file|
    cookies = process_file cookie_file
  end
  cookies
end