Created
June 28, 2013 10:26
-
-
Save walski/5883801 to your computer and use it in GitHub Desktop.
Why?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class WTF | |
attr_reader :color | |
def initialize | |
@color = 'red' | |
end | |
def color_with_self | |
color = self.color | |
color | |
end | |
def color_without_self | |
color = color | |
color | |
end | |
end | |
require "test/unit" | |
include Test::Unit::Assertions | |
color_with_self = WTF.new.color_with_self | |
assert(color_with_self == "red", "#{color_with_self.inspect} should be 'red'") | |
color_without_self = WTF.new.color_without_self | |
assert(color_without_self == "red", "#{color_without_self.inspect} should be 'red'") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment