mechanize 0.8.5 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of mechanize might be problematic. Click here for more details.
- data/GUIDE.txt +3 -5
- data/History.txt +10 -0
- data/Manifest.txt +0 -1
- data/Rakefile +1 -1
- data/lib/www/mechanize.rb +3 -4
- data/lib/www/mechanize/chain/uri_resolver.rb +5 -1
- data/lib/www/mechanize/form.rb +5 -5
- data/lib/www/mechanize/form/multi_select_list.rb +1 -1
- data/lib/www/mechanize/page.rb +22 -31
- data/mechanize.gemspec +17 -15
- metadata +5 -6
- data/lib/www/mechanize/list.rb +0 -52
data/GUIDE.txt
CHANGED
@@ -115,10 +115,8 @@ tell it what file name you want to upload:
|
|
115
115
|
form.file_uploads.first.file_name = "somefile.jpg"
|
116
116
|
|
117
117
|
== Scraping Data
|
118
|
-
Mechanize uses
|
118
|
+
Mechanize uses nokogiri[http://nokogiri.rubyforge.org/] to parse
|
119
119
|
html. What does this mean for you? You can treat a mechanize page like
|
120
|
-
an
|
121
|
-
that you need to scrape, then scrape it using
|
120
|
+
an nokogiri object. After you have used Mechanize to navigate to the page
|
121
|
+
that you need to scrape, then scrape it using nokogiri methods:
|
122
122
|
agent.get('http://someurl.com/').search(".//p[@class='posted']")
|
123
|
-
For more information on this powerful scraper, take a look at
|
124
|
-
HpricotBasics[http://code.whytheluckystiff.net/hpricot/wiki/HpricotBasics]
|
data/History.txt
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
= Mechanize CHANGELOG
|
2
2
|
|
3
|
+
=== 0.9.0
|
4
|
+
|
5
|
+
* Deprecations
|
6
|
+
* WWW::Mechanize::List is gone!
|
7
|
+
* Mechanize uses Nokogiri as it's HTML parser but you may switch to
|
8
|
+
Hpricot by using WWW::Mechanize.html_parser = Hpricot
|
9
|
+
|
10
|
+
* Bug Fixes:
|
11
|
+
* Nil check on page when base tag is used #23021
|
12
|
+
|
3
13
|
=== 0.8.5
|
4
14
|
|
5
15
|
* Deprecations
|
data/Manifest.txt
CHANGED
@@ -48,7 +48,6 @@ lib/www/mechanize/form/select_list.rb
|
|
48
48
|
lib/www/mechanize/headers.rb
|
49
49
|
lib/www/mechanize/history.rb
|
50
50
|
lib/www/mechanize/inspect.rb
|
51
|
-
lib/www/mechanize/list.rb
|
52
51
|
lib/www/mechanize/monkey_patch.rb
|
53
52
|
lib/www/mechanize/page.rb
|
54
53
|
lib/www/mechanize/page/base.rb
|
data/Rakefile
CHANGED
@@ -9,7 +9,7 @@ HOE = Hoe.new('mechanize', WWW::Mechanize::VERSION) do |p|
|
|
9
9
|
p.developer('Aaron Patterson','aaronp@rubyforge.org')
|
10
10
|
p.developer('Mike Dalessio','mike.dalessio@gmail.com')
|
11
11
|
p.summary = "Mechanize provides automated web-browsing"
|
12
|
-
p.extra_deps = [['
|
12
|
+
p.extra_deps = [['nokogiri', '>= 1.0.7']]
|
13
13
|
end
|
14
14
|
|
15
15
|
desc "Update SSL Certificate"
|
data/lib/www/mechanize.rb
CHANGED
@@ -6,7 +6,7 @@ require 'zlib'
|
|
6
6
|
require 'stringio'
|
7
7
|
require 'digest/md5'
|
8
8
|
require 'fileutils'
|
9
|
-
require '
|
9
|
+
require 'nokogiri'
|
10
10
|
require 'forwardable'
|
11
11
|
|
12
12
|
require 'www/mechanize/util'
|
@@ -18,7 +18,6 @@ require 'www/mechanize/redirect_not_get_or_head_error'
|
|
18
18
|
require 'www/mechanize/cookie'
|
19
19
|
require 'www/mechanize/cookie_jar'
|
20
20
|
require 'www/mechanize/history'
|
21
|
-
require 'www/mechanize/list'
|
22
21
|
require 'www/mechanize/form'
|
23
22
|
require 'www/mechanize/pluggable_parsers'
|
24
23
|
require 'www/mechanize/file_response'
|
@@ -47,7 +46,7 @@ module WWW
|
|
47
46
|
class Mechanize
|
48
47
|
##
|
49
48
|
# The version of Mechanize you are using.
|
50
|
-
VERSION = '0.
|
49
|
+
VERSION = '0.9.0'
|
51
50
|
|
52
51
|
##
|
53
52
|
# User Agent aliases
|
@@ -87,7 +86,7 @@ module WWW
|
|
87
86
|
|
88
87
|
alias :follow_redirect? :redirect_ok
|
89
88
|
|
90
|
-
@html_parser =
|
89
|
+
@html_parser = Nokogiri::HTML
|
91
90
|
class << self; attr_accessor :html_parser, :log end
|
92
91
|
|
93
92
|
def initialize
|
@@ -46,7 +46,11 @@ module WWW
|
|
46
46
|
|
47
47
|
if uri.relative?
|
48
48
|
raise 'need absolute URL' unless referer && referer.uri
|
49
|
-
base =
|
49
|
+
base = nil
|
50
|
+
if referer.respond_to?(:bases) && referer.parser
|
51
|
+
base = referer.bases.last
|
52
|
+
end
|
53
|
+
|
50
54
|
uri = ((base && base.uri && base.uri.absolute?) ?
|
51
55
|
base.uri :
|
52
56
|
referer.uri) + uri
|
data/lib/www/mechanize/form.rb
CHANGED
@@ -232,11 +232,11 @@ module WWW
|
|
232
232
|
|
233
233
|
private
|
234
234
|
def parse
|
235
|
-
@fields =
|
236
|
-
@buttons =
|
237
|
-
@file_uploads =
|
238
|
-
@radiobuttons =
|
239
|
-
@checkboxes =
|
235
|
+
@fields = []
|
236
|
+
@buttons = []
|
237
|
+
@file_uploads = []
|
238
|
+
@radiobuttons = []
|
239
|
+
@checkboxes = []
|
240
240
|
|
241
241
|
# Find all input tags
|
242
242
|
form_node.search('input').each do |node|
|
data/lib/www/mechanize/page.rb
CHANGED
@@ -86,56 +86,47 @@ module WWW
|
|
86
86
|
end
|
87
87
|
|
88
88
|
def links
|
89
|
-
@links ||=
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
end.flatten
|
95
|
-
)
|
89
|
+
@links ||= %w{ a area }.map do |tag|
|
90
|
+
search(tag).map do |node|
|
91
|
+
Link.new(node, @mech, self)
|
92
|
+
end
|
93
|
+
end.flatten
|
96
94
|
end
|
97
95
|
|
98
96
|
def forms
|
99
|
-
@forms ||=
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
end
|
105
|
-
)
|
97
|
+
@forms ||= search('form').map do |html_form|
|
98
|
+
form = Form.new(html_form, @mech, self)
|
99
|
+
form.action ||= @uri.to_s
|
100
|
+
form
|
101
|
+
end
|
106
102
|
end
|
107
103
|
|
108
104
|
def meta
|
109
|
-
@meta ||=
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
if
|
114
|
-
|
115
|
-
|
116
|
-
Meta.new(node, @mech, self)
|
117
|
-
end
|
105
|
+
@meta ||= search('meta').map do |node|
|
106
|
+
next unless node['http-equiv'] && node['content']
|
107
|
+
(equiv, content) = node['http-equiv'], node['content']
|
108
|
+
if equiv && equiv.downcase == 'refresh'
|
109
|
+
if content && content =~ /^\d+\s*;\s*url\s*=\s*'?([^\s']+)/i
|
110
|
+
node['href'] = $1
|
111
|
+
Meta.new(node, @mech, self)
|
118
112
|
end
|
119
|
-
end
|
120
|
-
|
113
|
+
end
|
114
|
+
end.compact
|
121
115
|
end
|
122
116
|
|
123
117
|
def bases
|
124
|
-
@bases ||=
|
118
|
+
@bases ||=
|
125
119
|
search('base').map { |node| Base.new(node, @mech, self) }
|
126
|
-
)
|
127
120
|
end
|
128
121
|
|
129
122
|
def frames
|
130
|
-
@frames ||=
|
123
|
+
@frames ||=
|
131
124
|
search('frame').map { |node| Frame.new(node, @mech, self) }
|
132
|
-
)
|
133
125
|
end
|
134
126
|
|
135
127
|
def iframes
|
136
|
-
@iframes ||=
|
128
|
+
@iframes ||=
|
137
129
|
search('iframe').map { |node| Frame.new(node, @mech, self) }
|
138
|
-
)
|
139
130
|
end
|
140
131
|
end
|
141
132
|
end
|
data/mechanize.gemspec
CHANGED
@@ -1,36 +1,38 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
1
3
|
Gem::Specification.new do |s|
|
2
4
|
s.name = %q{mechanize}
|
3
|
-
s.version = "0.8.
|
5
|
+
s.version = "0.8.5.20081221192100"
|
4
6
|
|
5
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
6
|
-
s.authors = ["Aaron Patterson"]
|
7
|
-
s.date = %q{2008-
|
8
|
+
s.authors = ["Aaron Patterson", "Mike Dalessio"]
|
9
|
+
s.date = %q{2008-12-21}
|
8
10
|
s.description = %q{The Mechanize library is used for automating interaction with websites. Mechanize automatically stores and sends cookies, follows redirects, can follow links, and submit forms. Form fields can be populated and submitted. Mechanize also keeps track of the sites that you have visited as a history.}
|
9
|
-
s.email =
|
10
|
-
s.extra_rdoc_files = ["EXAMPLES.txt", "FAQ.txt", "GUIDE.txt", "History.txt", "LICENSE.txt", "Manifest.txt", "
|
11
|
-
s.files = ["EXAMPLES.txt", "FAQ.txt", "GUIDE.txt", "History.txt", "LICENSE.txt", "Manifest.txt", "
|
11
|
+
s.email = ["aaronp@rubyforge.org", "mike.dalessio@gmail.com"]
|
12
|
+
s.extra_rdoc_files = ["EXAMPLES.txt", "FAQ.txt", "GUIDE.txt", "History.txt", "LICENSE.txt", "Manifest.txt", "README.txt"]
|
13
|
+
s.files = ["EXAMPLES.txt", "FAQ.txt", "GUIDE.txt", "History.txt", "LICENSE.txt", "Manifest.txt", "README.txt", "Rakefile", "examples/flickr_upload.rb", "examples/mech-dump.rb", "examples/proxy_req.rb", "examples/rubyforge.rb", "examples/spider.rb", "lib/mechanize.rb", "lib/www/mechanize.rb", "lib/www/mechanize/chain.rb", "lib/www/mechanize/chain/auth_headers.rb", "lib/www/mechanize/chain/body_decoding_handler.rb", "lib/www/mechanize/chain/connection_resolver.rb", "lib/www/mechanize/chain/custom_headers.rb", "lib/www/mechanize/chain/handler.rb", "lib/www/mechanize/chain/header_resolver.rb", "lib/www/mechanize/chain/parameter_resolver.rb", "lib/www/mechanize/chain/post_connect_hook.rb", "lib/www/mechanize/chain/pre_connect_hook.rb", "lib/www/mechanize/chain/request_resolver.rb", "lib/www/mechanize/chain/response_body_parser.rb", "lib/www/mechanize/chain/response_header_handler.rb", "lib/www/mechanize/chain/response_reader.rb", "lib/www/mechanize/chain/ssl_resolver.rb", "lib/www/mechanize/chain/uri_resolver.rb", "lib/www/mechanize/content_type_error.rb", "lib/www/mechanize/cookie.rb", "lib/www/mechanize/cookie_jar.rb", "lib/www/mechanize/file.rb", "lib/www/mechanize/file_response.rb", "lib/www/mechanize/file_saver.rb", "lib/www/mechanize/form.rb", "lib/www/mechanize/form/button.rb", "lib/www/mechanize/form/check_box.rb", "lib/www/mechanize/form/field.rb", "lib/www/mechanize/form/file_upload.rb", "lib/www/mechanize/form/image_button.rb", "lib/www/mechanize/form/multi_select_list.rb", "lib/www/mechanize/form/option.rb", "lib/www/mechanize/form/radio_button.rb", "lib/www/mechanize/form/select_list.rb", "lib/www/mechanize/headers.rb", "lib/www/mechanize/history.rb", "lib/www/mechanize/inspect.rb", "lib/www/mechanize/list.rb", "lib/www/mechanize/monkey_patch.rb", "lib/www/mechanize/page.rb", "lib/www/mechanize/page/base.rb", "lib/www/mechanize/page/frame.rb", "lib/www/mechanize/page/link.rb", "lib/www/mechanize/page/meta.rb", "lib/www/mechanize/pluggable_parsers.rb", "lib/www/mechanize/redirect_limit_reached_error.rb", "lib/www/mechanize/redirect_not_get_or_head_error.rb", "lib/www/mechanize/response_code_error.rb", "lib/www/mechanize/unsupported_scheme_error.rb", "lib/www/mechanize/util.rb", "mechanize.gemspec", "test/chain/test_argument_validator.rb", "test/chain/test_custom_headers.rb", "test/chain/test_parameter_resolver.rb", "test/chain/test_request_resolver.rb", "test/chain/test_response_reader.rb", "test/data/htpasswd", "test/data/server.crt", "test/data/server.csr", "test/data/server.key", "test/data/server.pem", "test/helper.rb", "test/htdocs/alt_text.html", "test/htdocs/bad_form_test.html", "test/htdocs/button.jpg", "test/htdocs/empty_form.html", "test/htdocs/file_upload.html", "test/htdocs/find_link.html", "test/htdocs/form_multi_select.html", "test/htdocs/form_multival.html", "test/htdocs/form_no_action.html", "test/htdocs/form_no_input_name.html", "test/htdocs/form_select.html", "test/htdocs/form_select_all.html", "test/htdocs/form_select_none.html", "test/htdocs/form_select_noopts.html", "test/htdocs/form_set_fields.html", "test/htdocs/form_test.html", "test/htdocs/frame_test.html", "test/htdocs/google.html", "test/htdocs/iframe_test.html", "test/htdocs/index.html", "test/htdocs/link with space.html", "test/htdocs/meta_cookie.html", "test/htdocs/no_title_test.html", "test/htdocs/relative/tc_relative_links.html", "test/htdocs/tc_bad_links.html", "test/htdocs/tc_base_link.html", "test/htdocs/tc_blank_form.html", "test/htdocs/tc_checkboxes.html", "test/htdocs/tc_encoded_links.html", "test/htdocs/tc_follow_meta.html", "test/htdocs/tc_form_action.html", "test/htdocs/tc_links.html", "test/htdocs/tc_no_attributes.html", "test/htdocs/tc_pretty_print.html", "test/htdocs/tc_radiobuttons.html", "test/htdocs/tc_referer.html", "test/htdocs/tc_relative_links.html", "test/htdocs/tc_textarea.html", "test/htdocs/unusual______.html", "test/servlets.rb", "test/ssl_server.rb", "test/test_authenticate.rb", "test/test_bad_links.rb", "test/test_blank_form.rb", "test/test_checkboxes.rb", "test/test_content_type.rb", "test/test_cookie_class.rb", "test/test_cookie_jar.rb", "test/test_cookies.rb", "test/test_encoded_links.rb", "test/test_errors.rb", "test/test_follow_meta.rb", "test/test_form_action.rb", "test/test_form_as_hash.rb", "test/test_form_button.rb", "test/test_form_no_inputname.rb", "test/test_forms.rb", "test/test_frames.rb", "test/test_get_headers.rb", "test/test_gzipping.rb", "test/test_hash_api.rb", "test/test_history.rb", "test/test_history_added.rb", "test/test_html_unscape_forms.rb", "test/test_if_modified_since.rb", "test/test_keep_alive.rb", "test/test_links.rb", "test/test_mech.rb", "test/test_mechanize_file.rb", "test/test_multi_select.rb", "test/test_no_attributes.rb", "test/test_option.rb", "test/test_page.rb", "test/test_pluggable_parser.rb", "test/test_post_form.rb", "test/test_pretty_print.rb", "test/test_radiobutton.rb", "test/test_redirect_limit_reached.rb", "test/test_redirect_verb_handling.rb", "test/test_referer.rb", "test/test_relative_links.rb", "test/test_response_code.rb", "test/test_save_file.rb", "test/test_scheme.rb", "test/test_select.rb", "test/test_select_all.rb", "test/test_select_none.rb", "test/test_select_noopts.rb", "test/test_set_fields.rb", "test/test_ssl_server.rb", "test/test_subclass.rb", "test/test_textarea.rb", "test/test_upload.rb", "test/test_verbs.rb"]
|
12
14
|
s.has_rdoc = true
|
13
15
|
s.homepage = %q{ http://mechanize.rubyforge.org/}
|
14
16
|
s.rdoc_options = ["--main", "README.txt"]
|
15
17
|
s.require_paths = ["lib"]
|
16
18
|
s.rubyforge_project = %q{mechanize}
|
17
|
-
s.rubygems_version = %q{1.
|
19
|
+
s.rubygems_version = %q{1.3.1}
|
18
20
|
s.summary = %q{Mechanize provides automated web-browsing}
|
19
|
-
s.test_files = ["test/chain/test_argument_validator.rb", "test/chain/test_custom_headers.rb", "test/chain/test_parameter_resolver.rb", "test/chain/test_request_resolver.rb", "test/chain/test_response_reader.rb", "test/test_authenticate.rb", "test/test_bad_links.rb", "test/test_blank_form.rb", "test/test_checkboxes.rb", "test/test_content_type.rb", "test/test_cookie_class.rb", "test/test_cookie_jar.rb", "test/test_cookies.rb", "test/test_encoded_links.rb", "test/test_errors.rb", "test/test_follow_meta.rb", "test/test_form_action.rb", "test/test_form_as_hash.rb", "test/test_form_button.rb", "test/test_form_no_inputname.rb", "test/test_forms.rb", "test/test_frames.rb", "test/test_get_headers.rb", "test/test_gzipping.rb", "test/test_hash_api.rb", "test/test_history.rb", "test/test_history_added.rb", "test/test_html_unscape_forms.rb", "test/test_if_modified_since.rb", "test/test_keep_alive.rb", "test/test_links.rb", "test/test_mech.rb", "test/test_mechanize_file.rb", "test/test_multi_select.rb", "test/test_no_attributes.rb", "test/test_option.rb", "test/test_page.rb", "test/test_pluggable_parser.rb", "test/test_post_form.rb", "test/test_pretty_print.rb", "test/test_radiobutton.rb", "test/test_redirect_limit_reached.rb", "test/test_referer.rb", "test/test_relative_links.rb", "test/test_response_code.rb", "test/test_save_file.rb", "test/test_scheme.rb", "test/test_select.rb", "test/test_select_all.rb", "test/test_select_none.rb", "test/test_select_noopts.rb", "test/test_set_fields.rb", "test/test_ssl_server.rb", "test/test_subclass.rb", "test/test_textarea.rb", "test/test_upload.rb", "test/test_verbs.rb"]
|
21
|
+
s.test_files = ["test/chain/test_argument_validator.rb", "test/chain/test_custom_headers.rb", "test/chain/test_parameter_resolver.rb", "test/chain/test_request_resolver.rb", "test/chain/test_response_reader.rb", "test/test_authenticate.rb", "test/test_bad_links.rb", "test/test_blank_form.rb", "test/test_checkboxes.rb", "test/test_content_type.rb", "test/test_cookie_class.rb", "test/test_cookie_jar.rb", "test/test_cookies.rb", "test/test_encoded_links.rb", "test/test_errors.rb", "test/test_follow_meta.rb", "test/test_form_action.rb", "test/test_form_as_hash.rb", "test/test_form_button.rb", "test/test_form_no_inputname.rb", "test/test_forms.rb", "test/test_frames.rb", "test/test_get_headers.rb", "test/test_gzipping.rb", "test/test_hash_api.rb", "test/test_history.rb", "test/test_history_added.rb", "test/test_html_unscape_forms.rb", "test/test_if_modified_since.rb", "test/test_keep_alive.rb", "test/test_links.rb", "test/test_mech.rb", "test/test_mechanize_file.rb", "test/test_multi_select.rb", "test/test_no_attributes.rb", "test/test_option.rb", "test/test_page.rb", "test/test_pluggable_parser.rb", "test/test_post_form.rb", "test/test_pretty_print.rb", "test/test_radiobutton.rb", "test/test_redirect_limit_reached.rb", "test/test_redirect_verb_handling.rb", "test/test_referer.rb", "test/test_relative_links.rb", "test/test_response_code.rb", "test/test_save_file.rb", "test/test_scheme.rb", "test/test_select.rb", "test/test_select_all.rb", "test/test_select_none.rb", "test/test_select_noopts.rb", "test/test_set_fields.rb", "test/test_ssl_server.rb", "test/test_subclass.rb", "test/test_textarea.rb", "test/test_upload.rb", "test/test_verbs.rb"]
|
20
22
|
|
21
23
|
if s.respond_to? :specification_version then
|
22
24
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
23
25
|
s.specification_version = 2
|
24
26
|
|
25
|
-
if
|
26
|
-
s.add_runtime_dependency(%q<
|
27
|
-
s.add_development_dependency(%q<hoe>, [">= 1.
|
27
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
28
|
+
s.add_runtime_dependency(%q<nokogiri>, [">= 1.0.7"])
|
29
|
+
s.add_development_dependency(%q<hoe>, [">= 1.8.2"])
|
28
30
|
else
|
29
|
-
s.add_dependency(%q<
|
30
|
-
s.add_dependency(%q<hoe>, [">= 1.
|
31
|
+
s.add_dependency(%q<nokogiri>, [">= 1.0.7"])
|
32
|
+
s.add_dependency(%q<hoe>, [">= 1.8.2"])
|
31
33
|
end
|
32
34
|
else
|
33
|
-
s.add_dependency(%q<
|
34
|
-
s.add_dependency(%q<hoe>, [">= 1.
|
35
|
+
s.add_dependency(%q<nokogiri>, [">= 1.0.7"])
|
36
|
+
s.add_dependency(%q<hoe>, [">= 1.8.2"])
|
35
37
|
end
|
36
38
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mechanize
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Patterson
|
@@ -10,18 +10,18 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2008-
|
13
|
+
date: 2008-12-21 00:00:00 -08:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
|
-
name:
|
17
|
+
name: nokogiri
|
18
18
|
type: :runtime
|
19
19
|
version_requirement:
|
20
20
|
version_requirements: !ruby/object:Gem::Requirement
|
21
21
|
requirements:
|
22
22
|
- - ">="
|
23
23
|
- !ruby/object:Gem::Version
|
24
|
-
version: 0.
|
24
|
+
version: 1.0.7
|
25
25
|
version:
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: hoe
|
@@ -100,7 +100,6 @@ files:
|
|
100
100
|
- lib/www/mechanize/headers.rb
|
101
101
|
- lib/www/mechanize/history.rb
|
102
102
|
- lib/www/mechanize/inspect.rb
|
103
|
-
- lib/www/mechanize/list.rb
|
104
103
|
- lib/www/mechanize/monkey_patch.rb
|
105
104
|
- lib/www/mechanize/page.rb
|
106
105
|
- lib/www/mechanize/page/base.rb
|
@@ -242,7 +241,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
242
241
|
requirements: []
|
243
242
|
|
244
243
|
rubyforge_project: mechanize
|
245
|
-
rubygems_version: 1.
|
244
|
+
rubygems_version: 1.3.1
|
246
245
|
signing_key:
|
247
246
|
specification_version: 2
|
248
247
|
summary: Mechanize provides automated web-browsing
|
data/lib/www/mechanize/list.rb
DELETED
@@ -1,52 +0,0 @@
|
|
1
|
-
module WWW
|
2
|
-
class Mechanize
|
3
|
-
# This class is deprecated and will be removed in Mechanize version 0.9.0
|
4
|
-
class List < Array
|
5
|
-
@@notified = false
|
6
|
-
|
7
|
-
# This method provides syntax sugar so that you can write expressions
|
8
|
-
# like this:
|
9
|
-
# form.fields.with.name('foo').and.href('bar.html')
|
10
|
-
#
|
11
|
-
def with
|
12
|
-
if !@@notified
|
13
|
-
$stderr.puts("This method is deprecated and will be removed in version 0.9.0. Please use: *_with(:#{meth_sym} => #{args.first ? args.first.inspect : 'nil'})")
|
14
|
-
@@notified = true
|
15
|
-
end
|
16
|
-
self
|
17
|
-
end
|
18
|
-
|
19
|
-
def value=(arg)
|
20
|
-
if !@@notified
|
21
|
-
$stderr.puts("This method is deprecated and will be removed in version 0.9.0. Please use: *_with(:#{meth_sym} => #{args.first ? args.first.inspect : 'nil'})")
|
22
|
-
@@notified = true
|
23
|
-
end
|
24
|
-
first().value=(arg)
|
25
|
-
end
|
26
|
-
|
27
|
-
alias :and :with
|
28
|
-
|
29
|
-
def respond_to?(method_sym)
|
30
|
-
first.respond_to?(method_sym)
|
31
|
-
end
|
32
|
-
|
33
|
-
def method_missing(meth_sym, *args)
|
34
|
-
if !@@notified
|
35
|
-
$stderr.puts("This method is deprecated and will be removed in version 0.9.0. Please use: *_with(:#{meth_sym} => #{args.first ? args.first.inspect : 'nil'})")
|
36
|
-
@@notified = true
|
37
|
-
end
|
38
|
-
if length > 0
|
39
|
-
return first.send(meth_sym) if args.empty?
|
40
|
-
arg = args.first
|
41
|
-
if arg.class == Regexp
|
42
|
-
WWW::Mechanize::List.new(find_all { |e| e.send(meth_sym) =~ arg })
|
43
|
-
else
|
44
|
-
WWW::Mechanize::List.new(find_all { |e| e.send(meth_sym) == arg })
|
45
|
-
end
|
46
|
-
else
|
47
|
-
''
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|