Skip to content

Commit

Permalink
Remove more warnings shadowing outer local variable.
Browse files Browse the repository at this point in the history
  • Loading branch information
miloops committed Sep 27, 2010
1 parent dafb4bd commit 583ddf2
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
6 changes: 3 additions & 3 deletions actionpack/lib/action_controller/metal/helpers.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ def all_application_helpers


def all_helpers_from_path(path) def all_helpers_from_path(path)
helpers = [] helpers = []
Array.wrap(path).each do |path| Array.wrap(path).each do |p|
extract = /^#{Regexp.quote(path.to_s)}\/?(.*)_helper.rb$/ extract = /^#{Regexp.quote(p.to_s)}\/?(.*)_helper.rb$/
helpers += Dir["#{path}/**/*_helper.rb"].map { |file| file.sub(extract, '\1') } helpers += Dir["#{p}/**/*_helper.rb"].map { |file| file.sub(extract, '\1') }
end end
helpers.sort! helpers.sort!
helpers.uniq! helpers.uniq!
Expand Down
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ def initialize(hash)
hash[k] = Conditions.new(v) hash[k] = Conditions.new(v)
when :children when :children
hash[k] = v = keys_to_symbols(v) hash[k] = v = keys_to_symbols(v)
v.each do |k,v2| v.each do |key,v2|
case k case key
when :count, :greater_than, :less_than when :count, :greater_than, :less_than
# keys are valid, and require no further processing # keys are valid, and require no further processing
when :only when :only
v[k] = Conditions.new(v2) v[key] = Conditions.new(v2)
else else
raise "illegal key #{k.inspect} => #{v2.inspect}" raise "illegal key #{k.inspect} => #{v2.inspect}"
end end
Expand Down
4 changes: 2 additions & 2 deletions actionpack/lib/action_dispatch/testing/assertions/selector.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -513,8 +513,8 @@ def assert_select_encoded(element = nil, &block)
node.content.gsub(/<!\[CDATA\[(.*)(\]\]>)?/m) { Rack::Utils.escapeHTML($1) } node.content.gsub(/<!\[CDATA\[(.*)(\]\]>)?/m) { Rack::Utils.escapeHTML($1) }
end end


selected = elements.map do |element| selected = elements.map do |ele|
text = element.children.select{ |c| not c.tag? }.map{ |c| fix_content[c] }.join text = ele.children.select{ |c| not c.tag? }.map{ |c| fix_content[c] }.join
root = HTML::Document.new(CGI.unescapeHTML("<encoded>#{text}</encoded>")).root root = HTML::Document.new(CGI.unescapeHTML("<encoded>#{text}</encoded>")).root
css_select(root, "encoded:root", &block)[0] css_select(root, "encoded:root", &block)[0]
end end
Expand Down
16 changes: 8 additions & 8 deletions actionpack/test/dispatch/response_test.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -120,10 +120,10 @@ def setup
end end


test "read cache control" do test "read cache control" do
resp = ActionDispatch::Response.new.tap { |resp| resp = ActionDispatch::Response.new.tap { |_resp|
resp.cache_control[:public] = true _resp.cache_control[:public] = true
resp.etag = '123' _resp.etag = '123'
resp.body = 'Hello' _resp.body = 'Hello'
} }
resp.to_a resp.to_a


Expand All @@ -135,10 +135,10 @@ def setup
end end


test "read charset and content type" do test "read charset and content type" do
resp = ActionDispatch::Response.new.tap { |resp| resp = ActionDispatch::Response.new.tap { |_resp|
resp.charset = 'utf-16' _resp.charset = 'utf-16'
resp.content_type = Mime::XML _resp.content_type = Mime::XML
resp.body = 'Hello' _resp.body = 'Hello'
} }
resp.to_a resp.to_a


Expand Down
2 changes: 1 addition & 1 deletion actionpack/test/template/text_helper_test.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ def test_auto_link_with_block
url = "http://api.rubyonrails.com/Foo.html" url = "http://api.rubyonrails.com/Foo.html"
email = "fantabulous@shiznadel.ic" email = "fantabulous@shiznadel.ic"


assert_equal %(<p><a href="#{url}">#{url[0...7]}...</a><br /><a href="mailto:#{email}">#{email[0...7]}...</a><br /></p>), auto_link("<p>#{url}<br />#{email}<br /></p>") { |url| truncate(url, :length => 10) } assert_equal %(<p><a href="#{url}">#{url[0...7]}...</a><br /><a href="mailto:#{email}">#{email[0...7]}...</a><br /></p>), auto_link("<p>#{url}<br />#{email}<br /></p>") { |u| truncate(u, :length => 10) }
end end


def test_auto_link_with_block_with_html def test_auto_link_with_block_with_html
Expand Down

0 comments on commit 583ddf2

Please sign in to comment.