class HTTP::CookieJar::AbstractStore
An abstract superclass for all store classes.
def add(cookie)
Implements HTTP::CookieJar#add().
def add(cookie) # self end
def class_to_symbol(klass) # :nodoc:
def class_to_symbol(klass) # :nodoc: klass.name[/[^:]+?(?=Store$|$)/].downcase.to_sym end
def cleanup(session = false)
Implements HTTP::CookieJar#cleanup().
def cleanup(session = false) # if session # select { |cookie| cookie.session? || cookie.expired? } # else # select(&:expired?) # end.each { |cookie| # delete(cookie) # } # # subclasses can optionally remove over-the-limit cookies. # self end
def clear
Implements HTTP::CookieJar#clear().
def clear # self end
def default_options
def default_options # {} end
def delete(cookie)
Implements HTTP::CookieJar#delete().
def delete(cookie) # self end
def each(uri = nil, &block) # :yield: cookie
This is an abstract method that each subclass must override.
each cookie is updated to the current time.
If (and only if) the +uri+ option is given, last access time of
i.e. cookie.valid_for_uri?(uri) evaluates to true.
should be good to send to the given URI,
destination of the cookies being selected. Every cookie yielded
An optional argument +uri+ specifies a URI object indicating the
Iterates over all cookies that are not expired.
def each(uri = nil, &block) # :yield: cookie # if uri # ... # else # synchronize { # ... # } # end # self end
def empty?
def empty? each { return false } true end
def implementation(symbol)
load "http/cookie_jar/*_store" if not found. If loading fails,
Gets an implementation class by the name, optionally trying to
def implementation(symbol) @@class_map.fetch(symbol) rescue IndexError begin require 'http/cookie_jar/%s_store' % symbol @@class_map.fetch(symbol) rescue LoadError, IndexError => e raise IndexError, 'cookie store unavailable: %s, error: %s' % [symbol.inspect, e.message] end end
def inherited(subclass) # :nodoc:
def inherited(subclass) # :nodoc: @@class_map[class_to_symbol(subclass)] = subclass end
def initialize(options = nil)
new(**options)
:call-seq:
def initialize(options = nil) super() # MonitorMixin options ||= {} @logger = options[:logger] # 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
def initialize_copy(other)
def initialize_copy(other) # self end