Class: Ronin::Web::Browser::CookieFile
- Inherits:
-
Object
- Object
- Ronin::Web::Browser::CookieFile
- Includes:
- Enumerable
- Defined in:
- lib/ronin/web/browser/cookie_file.rb
Overview
Represents a file of cookies.
Instance Attribute Summary collapse
-
#path ⇒ String
readonly
The path to the file.
Class Method Summary collapse
-
.save(path, cookies) ⇒ Object
Writes the cookies to the cookie file.
Instance Method Summary collapse
-
#each {|cookie| ... } ⇒ Enumerator
Parses each cookie in the cookie file.
-
#initialize(path) ⇒ CookieFile
constructor
Initializes a cookie file.
Constructor Details
#initialize(path) ⇒ CookieFile
Initializes a cookie file.
44 45 46 |
# File 'lib/ronin/web/browser/cookie_file.rb', line 44 def initialize(path) @path = File.(path) end |
Instance Attribute Details
#path ⇒ String (readonly)
The path to the file.
36 37 38 |
# File 'lib/ronin/web/browser/cookie_file.rb', line 36 def path @path end |
Class Method Details
.save(path, cookies) ⇒ Object
Writes the cookies to the cookie file.
57 58 59 60 61 62 63 |
# File 'lib/ronin/web/browser/cookie_file.rb', line 57 def self.save(path,) File.open(path,'w') do |file| .each do || file.puts() end end end |
Instance Method Details
#each {|cookie| ... } ⇒ Enumerator
Parses each cookie in the cookie file.
78 79 80 81 82 83 84 85 86 |
# File 'lib/ronin/web/browser/cookie_file.rb', line 78 def each return enum_for(__method__) unless block_given? File.open(@path) do |file| file.each_line(chomp: true) do |line| yield Cookie.parse(line) end end end |