Unused variable removed #3608

merged 1 commit into from Nov 16, 2011


None yet

3 participants

Ruby on Rails member

Warning removed unused variables.

@henrikhodne henrikhodne commented on the diff Nov 11, 2011
@@ -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")
henrikhodne Nov 11, 2011

How about this?

app = Rack::Builder.parse_file("#{app_path}/config.ru").first
arunagw Nov 11, 2011

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

henrikhodne Nov 11, 2011

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.

henrikhodne Nov 11, 2011

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


The tests pass on 1.9.3p0.

@jonleighton jonleighton merged commit a152fd3 into rails:master Nov 16, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment