Class: HTTP::CookieJar::AbstractSaver
- Inherits:
-
Object
- Object
- HTTP::CookieJar::AbstractSaver
- Defined in:
- lib/http/cookie_jar/abstract_saver.rb
Overview
An abstract superclass for all saver classes.
Direct Known Subclasses
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options = nil) ⇒ AbstractSaver
constructor
:call-seq: new(**options).
-
#load(io, jar) ⇒ Object
Implements HTTP::CookieJar#load().
-
#save(io, jar) ⇒ Object
Implements HTTP::CookieJar#save().
Constructor Details
#initialize(options = nil) ⇒ AbstractSaver
:call-seq:
new(**)
Called by the constructor of each subclass using super().
27 28 29 30 31 32 33 34 35 36 |
# File 'lib/http/cookie_jar/abstract_saver.rb', line 27 def initialize( = nil) ||= {} @logger = [:logger] @session = [:session] # Initializes each instance variable of the same name as option # keyword. .each_pair { |key, default| instance_variable_set("@#{key}", .fetch(key, default)) } end |
Class Method Details
.implementation(symbol) ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/http/cookie_jar/abstract_saver.rb', line 6 def self.implementation(symbol) case symbol when :yaml HTTP::CookieJar::YAMLSaver when :cookiestxt HTTP::CookieJar::CookiestxtSaver else raise IndexError, 'cookie saver unavailable: %s' % symbol.inspect end end |
Instance Method Details
#load(io, jar) ⇒ Object
Implements HTTP::CookieJar#load().
This is an abstract method that each subclass must override.
48 49 50 |
# File 'lib/http/cookie_jar/abstract_saver.rb', line 48 def load(io, jar) # self end |
#save(io, jar) ⇒ Object
Implements HTTP::CookieJar#save().
This is an abstract method that each subclass must override.
41 42 43 |
# File 'lib/http/cookie_jar/abstract_saver.rb', line 41 def save(io, jar) # self end |