mirror of
https://github.com/samsonjs/http-cookie.git
synced 2026-03-25 08:55:53 +00:00
Improve rdoc.
This commit is contained in:
parent
38f7e98f09
commit
6dda359db1
4 changed files with 20 additions and 5 deletions
15
README.md
15
README.md
|
|
@ -111,6 +111,19 @@ equivalent using `HTTP::Cookie`:
|
||||||
# after
|
# after
|
||||||
jar.save(file)
|
jar.save(file)
|
||||||
|
|
||||||
|
- `Mechanize::CookieJar#jar`
|
||||||
|
|
||||||
|
There is no direct access to the internal hash in
|
||||||
|
`HTTP::CookieJar` since it has introduced an abstract storage
|
||||||
|
layer. If you want to tweak the internals of the hash storage,
|
||||||
|
try creating a new storage class referring to the default storage
|
||||||
|
class `HTTP::CookieJar::HashStore`.
|
||||||
|
|
||||||
|
If you desperately need it you can access it by
|
||||||
|
`jar.store.instance_variable_get(:@jar)`, but there is no
|
||||||
|
guarantee that it will remain available in the future.
|
||||||
|
|
||||||
|
|
||||||
`HTTP::Cookie`/`CookieJar` raise runtime errors to help migration, so
|
`HTTP::Cookie`/`CookieJar` raise runtime errors to help migration, so
|
||||||
after replacing the class names, try running your test code once to
|
after replacing the class names, try running your test code once to
|
||||||
find out how to fix your code base.
|
find out how to fix your code base.
|
||||||
|
|
@ -128,7 +141,7 @@ Trying to load a YAML file saved by `HTTP::CookieJar` with
|
||||||
`Mechanize::CookieJar` will fail in runtime error.
|
`Mechanize::CookieJar` will fail in runtime error.
|
||||||
|
|
||||||
On the other hand, there has been (and will ever be) no change in the
|
On the other hand, there has been (and will ever be) no change in the
|
||||||
cookies.txt format, so use it instead if compatibility is required.
|
cookies.txt format, so use it instead if compatibility is significant.
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ Gem::Specification.new do |gem|
|
||||||
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
||||||
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
||||||
gem.require_paths = ["lib"]
|
gem.require_paths = ["lib"]
|
||||||
|
gem.extra_rdoc_files = ['README.md', 'LICENSE.txt']
|
||||||
|
|
||||||
gem.add_runtime_dependency("domain_name", ["~> 0.5"])
|
gem.add_runtime_dependency("domain_name", ["~> 0.5"])
|
||||||
gem.add_development_dependency("bundler", [">= 1.2.0"])
|
gem.add_development_dependency("bundler", [">= 1.2.0"])
|
||||||
|
|
|
||||||
|
|
@ -13,8 +13,7 @@ if RUBY_VERSION < "1.9.3"
|
||||||
begin
|
begin
|
||||||
URI(URI(''))
|
URI(URI(''))
|
||||||
rescue
|
rescue
|
||||||
# :nodoc:
|
def URI(url) # :nodoc:
|
||||||
def URI(url)
|
|
||||||
url.is_a?(URI) ? url : URI.parse(url)
|
url.is_a?(URI) ? url : URI.parse(url)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -239,9 +238,9 @@ class HTTP::Cookie
|
||||||
# * Order of parameters is a slightly different in
|
# * Order of parameters is a slightly different in
|
||||||
# `HTTP::Cookie.parse`. Compare these:
|
# `HTTP::Cookie.parse`. Compare these:
|
||||||
#
|
#
|
||||||
# Mechanize::Cookie.parse(uri, set_cookie[, log])
|
# Mechanize::Cookie.parse(uri, set_cookie[, log])
|
||||||
#
|
#
|
||||||
# HTTP::Cookie.parse(set_cookie, :origin => uri[, :logger => # log])
|
# HTTP::Cookie.parse(set_cookie, :origin => uri[, :logger => # log])
|
||||||
#
|
#
|
||||||
# * `HTTP::Cookie.parse` does not yield nil nor include nil in an
|
# * `HTTP::Cookie.parse` does not yield nil nor include nil in an
|
||||||
# returned array. It simply ignores unparsable parts.
|
# returned array. It simply ignores unparsable parts.
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,12 @@
|
||||||
require 'http/cookie_jar'
|
require 'http/cookie_jar'
|
||||||
|
|
||||||
|
# :stopdoc:
|
||||||
class Array
|
class Array
|
||||||
def sort_by!(&block)
|
def sort_by!(&block)
|
||||||
replace(sort_by(&block))
|
replace(sort_by(&block))
|
||||||
end unless method_defined?(:sort_by!)
|
end unless method_defined?(:sort_by!)
|
||||||
end
|
end
|
||||||
|
# :startdoc:
|
||||||
|
|
||||||
class HTTP::CookieJar
|
class HTTP::CookieJar
|
||||||
class HashStore < AbstractStore
|
class HashStore < AbstractStore
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue