Improve rdoc.

This commit is contained in:
Akinori MUSHA 2013-03-23 00:37:21 +09:00
parent 38f7e98f09
commit 6dda359db1
4 changed files with 20 additions and 5 deletions

View file

@ -111,6 +111,19 @@ equivalent using `HTTP::Cookie`:
# after
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
after replacing the class names, try running your test code once to
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.
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

View file

@ -21,6 +21,7 @@ Gem::Specification.new do |gem|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
gem.require_paths = ["lib"]
gem.extra_rdoc_files = ['README.md', 'LICENSE.txt']
gem.add_runtime_dependency("domain_name", ["~> 0.5"])
gem.add_development_dependency("bundler", [">= 1.2.0"])

View file

@ -13,8 +13,7 @@ if RUBY_VERSION < "1.9.3"
begin
URI(URI(''))
rescue
# :nodoc:
def URI(url)
def URI(url) # :nodoc:
url.is_a?(URI) ? url : URI.parse(url)
end
end
@ -239,9 +238,9 @@ class HTTP::Cookie
# * Order of parameters is a slightly different in
# `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
# returned array. It simply ignores unparsable parts.

View file

@ -1,10 +1,12 @@
require 'http/cookie_jar'
# :stopdoc:
class Array
def sort_by!(&block)
replace(sort_by(&block))
end unless method_defined?(:sort_by!)
end
# :startdoc:
class HTTP::CookieJar
class HashStore < AbstractStore