Class: HTTP::CookieJar::AbstractSaver

### Home Classes Methods

### In Files

- lib/http/cookie_jar/abstract_saver.rb

### Parent

Object

### Methods

- ::implementation
- ::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::AbstractSaver

An abstract superclass for all saver classes.

### Public Class Methods

implementation(symbol) click to toggle source

Gets an implementation class by the name, optionally trying to load "http/cookie_jar/*_saver" if not found. If loading fails, IndexError is raised.

    # File lib/http/cookie_jar/abstract_saver.rb, line 11
    def implementation(symbol)
      @@class_map.fetch(symbol)
    rescue IndexError
      begin
        require 'http/cookie_jar/%s_saver' % symbol
        @@class_map.fetch(symbol)
      rescue LoadError, IndexError
        raise IndexError, 'cookie saver unavailable: %s' % symbol.inspect
      end
    end

new(**options) click to toggle source

Called by the constructor of each subclass using super().

    # File lib/http/cookie_jar/abstract_saver.rb, line 41
    def initialize(options = nil)
      options ||= {}
      @logger  = options[:logger]
      @session = options[:session]
      # Initializes each instance variable of the same name as option
      # keyword.
      default_options.each_pair { |key, default|
        instance_variable_set("@#{key}", options.fetch(key, default))
      }
    end

### Public Instance Methods

load(io, jar) click to toggle source

Implements HTTP::CookieJar#load().

This is an abstract method that each subclass must override.

    # File lib/http/cookie_jar/abstract_saver.rb, line 62
    def load(io, jar)
      # self
    end

save(io, jar) click to toggle source

Implements HTTP::CookieJar#save().

This is an abstract method that each subclass must override.

    # File lib/http/cookie_jar/abstract_saver.rb, line 55
    def save(io, jar)
      # self
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.