Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Warning for instance variable. #132

Closed
wants to merge 1 commit into from

4 participants

@konieczkow

I noticed that while running the tests in rails3 there are warnings. instance variable @mute not initialized. Hope i didn't broke anything.
Added defined? @mute to get rid of "instance variable @mute not initialized" when running rails3 railties tests.

@elmar

I was tripped by this too and it turns out I had the environment variable RUBYOPT="-w" set. I was puzzled when I wanted to reproduce this bug in a clean install on a test account. The clean test account showed no warnings while my regular development account showed many.

I hope this comment helps people if they want to reproduce such bug reports.

The fix is probably worthwile anyway but it may be better to add @mute = nil to Thor::Shell::Basic#initialize

@wycats
Owner

I prefer @elmar's solution here.

@rohit

Why can't it be ―

  def mute?
    @mute ||= false
  end

That will avoid the warning AFAIK and will give the same result right? If things are good as it is then maybe this pull request can be closed. :)

@wycats
Owner

@rohit want to submit a pull request for this? I'm closing this one as I like your solution.

@wycats wycats closed this
@sferik sferik referenced this pull request from a commit
@sferik sferik Revert "silence instance var not initialized warning #132"
This reverts commit 7a64f87.
20a96f2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 23, 2011
  1. @konieczkow

    Added defined? @mute to get rid of "instance variable @mute not initi…

    konieczkow authored
    …alized" when running rails3 railties tests.
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 1 deletion.
  1. +1 −1  lib/thor/shell/basic.rb
View
2  lib/thor/shell/basic.rb
@@ -23,7 +23,7 @@ def mute
# Check if base is muted
#
def mute?
- @mute
+ defined?(@mute) ? @mute : false
end
# Sets the output padding, not allowing less than zero values.
Something went wrong with that request. Please try again.