Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Unused variable removed #3608

Merged
merged 1 commit into from

3 participants

Arun Agrawal Henrik Hodne Jon Leighton
Arun Agrawal
Collaborator

Warning removed unused variables.

Henrik Hodne henrikhodne commented on the diff
railties/test/application/rackup_test.rb
@@ -6,7 +6,7 @@ module ApplicationTests
def rackup
require "rack"
- app, options = Rack::Builder.parse_file("#{app_path}/config.ru")
+ app, _ = Rack::Builder.parse_file("#{app_path}/config.ru")

How about this?

app = Rack::Builder.parse_file("#{app_path}/config.ru").first
Arun Agrawal Collaborator
arunagw added a note

Yeah test will pass. But dont want to make anothe .first. I think this looks ok to know that this method is returimg an array

I'm not quite sure how _ works in Ruby, but if it's a valid variable name I think that using the _ will put the object in that scope, while using first won't. I could be wrong on this though.

Actually, after some benchmarking I see first is slightly slower.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Henrik Hodne

The tests pass on 1.9.3p0.

Jon Leighton jonleighton merged commit a152fd3 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 15, 2011
  1. Arun Agrawal

    Unused variable removed

    arunagw authored
This page is out of date. Refresh to see the latest.
1  railties/test/application/console_test.rb
View
@@ -71,7 +71,6 @@ class User
assert !User.new.respond_to?(:age)
silence_stream(STDOUT) { irb_context.reload! }
- session = irb_context.new_session
assert User.new.respond_to?(:age)
end
2  railties/test/application/rackup_test.rb
View
@@ -6,7 +6,7 @@ class RackupTest < Test::Unit::TestCase
def rackup
require "rack"
- app, options = Rack::Builder.parse_file("#{app_path}/config.ru")
+ app, _ = Rack::Builder.parse_file("#{app_path}/config.ru")

How about this?

app = Rack::Builder.parse_file("#{app_path}/config.ru").first
Arun Agrawal Collaborator
arunagw added a note

Yeah test will pass. But dont want to make anothe .first. I think this looks ok to know that this method is returimg an array

I'm not quite sure how _ works in Ruby, but if it's a valid variable name I think that using the _ will put the object in that scope, while using first won't. I could be wrong on this though.

Actually, after some benchmarking I see first is slightly slower.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
app
end
Something went wrong with that request. Please try again.