Skip to content

Instantly share code, notes, and snippets.

@halorgium
Forked from walski/wtf.rb
Last active December 19, 2015 02:29
Show Gist options
  • Save halorgium/5883863 to your computer and use it in GitHub Desktop.
Save halorgium/5883863 to your computer and use it in GitHub Desktop.
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"
class WTFTest < Test::Unit::TestCase
def test_with_self
assert_equal "red", WTF.new.color_with_self
end
def test_without_self
assert_equal "red", WTF.new.color_without_self
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment