Skip to content
Browse files

Fix a few warnings of unused variables

  • Loading branch information...
1 parent a7dd0bb commit 86cf7d3e960151d0317890ff360f8c8dbed7d540 @carlosantoniodasilva carlosantoniodasilva committed Jan 8, 2013
View
37 actionpack/lib/action_controller/caching/fragments.rb
@@ -1,11 +1,11 @@
module ActionController #:nodoc:
module Caching
- # Fragment caching is used for caching various blocks within
+ # Fragment caching is used for caching various blocks within
# views without caching the entire action as a whole. This is
- # useful when certain elements of an action change frequently or
- # depend on complicated state while other parts rarely change or
+ # useful when certain elements of an action change frequently or
+ # depend on complicated state while other parts rarely change or
# can be shared amongst multiple parties. The caching is done using
- # the <tt>cache</tt> helper available in the Action View. A
+ # the <tt>cache</tt> helper available in the Action View. A
# template with fragment caching might look like:
#
# <b>Hello <%= @name %></b>
@@ -16,43 +16,43 @@ module Caching
# <% end %>
#
# This cache will bind the name of the action that called it, so if
- # this code was part of the view for the topics/list action, you
+ # this code was part of the view for the topics/list action, you
# would be able to invalidate it using:
- #
+ #
# expire_fragment(:controller => "topics", :action => "list")
#
- # This default behavior is limited if you need to cache multiple
- # fragments per action or if the action itself is cached using
- # <tt>caches_action</tt>. To remedy this, there is an option to
- # qualify the name of the cached fragment by using the
+ # This default behavior is limited if you need to cache multiple
+ # fragments per action or if the action itself is cached using
+ # <tt>caches_action</tt>. To remedy this, there is an option to
+ # qualify the name of the cached fragment by using the
# <tt>:action_suffix</tt> option:
#
# <% cache(:action => "list", :action_suffix => "all_topics") do %>
#
- # That would result in a name such as
- # <tt>/topics/list/all_topics</tt>, avoiding conflicts with the
+ # That would result in a name such as
+ # <tt>/topics/list/all_topics</tt>, avoiding conflicts with the
# action cache and with any fragments that use a different suffix.
# Note that the URL doesn't have to really exist or be callable
# - the url_for system is just used to generate unique cache names
# that we can refer to when we need to expire the cache.
#
# The expiration call for this example is:
#
- # expire_fragment(:controller => "topics",
- # :action => "list",
+ # expire_fragment(:controller => "topics",
+ # :action => "list",
# :action_suffix => "all_topics")
module Fragments
# Given a key (as described in <tt>expire_fragment</tt>), returns
- # a key suitable for use in reading, writing, or expiring a
+ # a key suitable for use in reading, writing, or expiring a
# cached fragment. If the key is a hash, the generated key is the
- # return value of url_for on that hash (without the protocol).
+ # return value of url_for on that hash (without the protocol).
# All keys are prefixed with <tt>views/</tt> and uses
# ActiveSupport::Cache.expand_cache_key for the expansion.
def fragment_cache_key(key)
ActiveSupport::Cache.expand_cache_key(key.is_a?(Hash) ? url_for(key).split("://").last : key, :views)
end
- # Writes <tt>content</tt> to the location signified by
+ # Writes <tt>content</tt> to the location signified by
# <tt>key</tt> (see <tt>expire_fragment</tt> for acceptable formats).
def write_fragment(key, content, options = nil)
return content unless cache_configured?
@@ -77,7 +77,7 @@ def read_fragment(key, options = nil)
end
end
- # Check if a cached fragment from the location signified by
+ # Check if a cached fragment from the location signified by
# <tt>key</tt> exists (see <tt>expire_fragment</tt> for acceptable formats)
def fragment_exist?(key, options = nil)
return unless cache_configured?
@@ -109,7 +109,6 @@ def fragment_exist?(key, options = nil)
def expire_fragment(key, options = nil)
return unless cache_configured?
key = fragment_cache_key(key) unless key.is_a?(Regexp)
- message = nil
instrument_fragment_cache :expire_fragment, key do
if key.is_a?(Regexp)
View
2 actionpack/lib/action_controller/metal/http_authentication.rb
@@ -426,7 +426,7 @@ def authenticate(controller, &login_procedure)
# Returns an Array of [String, Hash] if a token is present.
# Returns nil if no token is found.
def token_and_options(request)
- if header = request.authorization.to_s[/^Token (.*)/]
+ if request.authorization.to_s[/^Token (.*)/]
values = Hash[$1.split(',').map do |value|
value.strip! # remove any spaces between commas and values
key, value = value.split(/\=\"?/) # split key=value pairs
View
3 actionpack/lib/action_dispatch/http/response.rb
@@ -33,7 +33,8 @@ module ActionDispatch # :nodoc:
# end
# end
class Response
- attr_accessor :request, :header, :status
+ attr_accessor :request, :header
+ attr_reader :status
attr_writer :sending_file
alias_method :headers=, :header=
View
2 actionpack/lib/action_dispatch/middleware/head.rb
@@ -8,7 +8,7 @@ def call(env)
if env["REQUEST_METHOD"] == "HEAD"
env["REQUEST_METHOD"] = "GET"
env["rack.methodoverride.original_method"] = "HEAD"
- status, headers, body = @app.call(env)
+ status, headers, _ = @app.call(env)
[status, headers, []]
else
@app.call(env)
View
3 actionpack/lib/action_dispatch/testing/integration.rb
@@ -215,9 +215,6 @@ def reset!
"*/*;q=0.5"
unless defined? @named_routes_configured
- # install the named routes in this session instance.
- klass = singleton_class
-
# the helpers are made protected by default--we make them public for
# easier access during testing and troubleshooting.
@named_routes_configured = true
View
2 actionpack/lib/action_view/helpers/debug_helper.rb
@@ -30,7 +30,7 @@ def debug(object)
begin
Marshal::dump(object)
"<pre class='debug_dump'>#{h(object.to_yaml).gsub(" ", "&nbsp; ")}</pre>".html_safe
- rescue Exception => e # errors from Marshal or YAML
+ rescue Exception # errors from Marshal or YAML
# Object couldn't be dumped, perhaps because of singleton methods -- this is the fallback
"<code class='debug_dump'>#{h(object.inspect)}</code>".html_safe
end
View
2 actionpack/lib/action_view/renderer/template_renderer.rb
@@ -64,7 +64,7 @@ def find_layout(layout, keys)
layout =~ /^\// ?
with_fallbacks { find_template(layout, nil, false, keys) } : find_template(layout, nil, false, keys)
end
- rescue ActionView::MissingTemplate => e
+ rescue ActionView::MissingTemplate
update_details(:formats => nil) do
raise unless template_exists?(layout)
end
View
1 actionpack/lib/action_view/template/error.rb
@@ -31,7 +31,6 @@ class MissingTemplate < ActionViewError #:nodoc:
def initialize(paths, path, prefixes, partial, details, *)
@path = path
prefixes = Array.wrap(prefixes)
- display_paths = paths.compact.map{ |p| p.to_s.inspect }.join(", ")
template_type = if partial
"partial"
elsif path =~ /layouts/i
View
2 actionpack/test/abstract/abstract_controller_test.rb
@@ -187,7 +187,7 @@ def index
class TestLayouts < ActiveSupport::TestCase
test "layouts are included" do
controller = Me4.new
- result = controller.process(:index)
+ controller.process(:index)
assert_equal "Me4 Enter : Hello from me4/index.erb : Exit", controller.response_body
end
end
View
2 activerecord/lib/active_record/base.rb
@@ -2071,7 +2071,7 @@ def read_date_parameter_value(name, values_hash_from_param)
set_values = (1..3).collect{|position| values_hash_from_param[position].blank? ? 1 : values_hash_from_param[position]}
begin
Date.new(*set_values)
- rescue ArgumentError => ex # if Date.new raises an exception on an invalid date
+ rescue ArgumentError # if Date.new raises an exception on an invalid date
instantiate_time_object(name, set_values).to_date # we instantiate Time object and convert it back to a date thus using Time's logic in handling invalid dates
end
end

0 comments on commit 86cf7d3

Please sign in to comment.
Something went wrong with that request. Please try again.