cosmetic changes
parent
cc6f42b796
commit
c783485d9a
|
@ -193,7 +193,6 @@ class Mechanize
|
|||
# submitted with multiple buttons, pass each button to this method.
|
||||
def add_button_to_query(button)
|
||||
unless button.form_node == @node
|
||||
message = ""
|
||||
"#{button.inspect} does not belong to the same page as " \
|
||||
"the form #{@name.inspect} in #{@page.try &.uri}"
|
||||
message = "not a valid button"
|
||||
|
|
|
@ -23,10 +23,14 @@ class Mechanize::FormContent::SelectList < Mechanize::FormContent::MultiSelectLi
|
|||
end
|
||||
|
||||
def value=(new_value)
|
||||
values = new_value
|
||||
@values = new_value
|
||||
end
|
||||
|
||||
def query_value
|
||||
value ? [[name, value.not_nil!]] : nil
|
||||
if v = value
|
||||
[[name, v]]
|
||||
else
|
||||
nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -30,7 +30,7 @@ class Mechanize
|
|||
if size == 0
|
||||
# TODO: raise error
|
||||
end
|
||||
page = @array.pop
|
||||
@array.pop
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -318,7 +318,6 @@ class Mechanize
|
|||
|
||||
# extract valid cookies according to URI
|
||||
private def valid_cookies(uri)
|
||||
host = uri.host
|
||||
valid_cookies = ::HTTP::Cookies.new
|
||||
request_cookies.each do |cookie|
|
||||
valid_cookies << cookie if cookie.valid_cookie?(uri)
|
||||
|
|
|
@ -127,7 +127,7 @@ class Mechanize
|
|||
|
||||
return nil unless value
|
||||
|
||||
return [name, value]
|
||||
[name, value]
|
||||
end
|
||||
|
||||
##
|
||||
|
|
|
@ -43,11 +43,11 @@ class Mechanize
|
|||
# page.forms # => Array(Mechanize::Form)
|
||||
# ```
|
||||
def forms : Array(Form)
|
||||
forms = css("form").map do |html_form|
|
||||
css("form").map do |html_form|
|
||||
form = Form.new(html_form, self)
|
||||
form.action ||= @uri.to_s
|
||||
form
|
||||
end.to_a
|
||||
end
|
||||
end
|
||||
|
||||
# return all links(`Mechanize::PageContent::Link`) in the page.
|
||||
|
@ -55,11 +55,11 @@ class Mechanize
|
|||
# page.links # => Array(Mechanize::PageContent::Link)
|
||||
# ```
|
||||
def links : Array(PageContent::Link)
|
||||
links = %w{a area}.map do |tag|
|
||||
%w{a area}.flat_map do |tag|
|
||||
css(tag).map do |node|
|
||||
PageContent::Link.new(node, @mech, self)
|
||||
end
|
||||
end.flatten
|
||||
end
|
||||
end
|
||||
|
||||
elements_with "form"
|
||||
|
|
|
@ -5,7 +5,7 @@ class Mechanize
|
|||
macro elements_with(singular, plural = "")
|
||||
{% plural = "#{singular.id}s" if plural.empty? %}
|
||||
# search {{ plural.id }} which match condition.
|
||||
#
|
||||
#
|
||||
# Examples
|
||||
# ```
|
||||
# # if you specify String like "foo", it searches {{ singular.id }} which name is "foo".
|
||||
|
|
Loading…
Reference in New Issue