Class: HTTP::CookieJar::CookiestxtSaver

### Home Classes Methods

### In Files

- lib/http/cookie_jar/cookiestxt_saver.rb

### Parent

HTTP::CookieJar::AbstractSaver

### Methods

- ::new
- #load
- #save

### Files

- LICENSE.txt

### Class/Module Index

Quicksearch

- HTTP
- HTTP::Cookie
- HTTP::Cookie::Scanner
- HTTP::CookieJar
- HTTP::CookieJar::AbstractSaver
- HTTP::CookieJar::AbstractStore
- HTTP::CookieJar::CookiestxtSaver
- HTTP::CookieJar::HashStore
- HTTP::CookieJar::MozillaStore
- HTTP::CookieJar::YAMLSaver
- Array
- Hash
- String

No matching classes.

# HTTP::CookieJar::CookiestxtSaver

CookiestxtSaver saves and loads cookies in the cookies.txt format.

### Public Class Methods

new(**options) click to toggle source

Available option keywords are below:

- `:header`

      Specifies the header line not including a line feed, which is
      only used by #save().  None is output if nil is
      given. (default: `"# HTTP Cookie File"`)

- `:linefeed`

      Specifies the line separator (default: `"\n"`).

    # File lib/http/cookie_jar/cookiestxt_saver.rb, line 22

### Public Instance Methods

load(io, jar) click to toggle source

    # File lib/http/cookie_jar/cookiestxt_saver.rb, line 32
    def load(io, jar)
      io.each_line { |line|
        cookie = parse_record(line) and jar.add(cookie)
      }
    end

save(io, jar) click to toggle source

    # File lib/http/cookie_jar/cookiestxt_saver.rb, line 24
    def save(io, jar)
      io.puts @header if @header
      jar.each { |cookie|
        next if !@session && cookie.session?
        io.print cookie_to_record(cookie)
      }
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.