Skip to content

Instantly share code, notes, and snippets.

@joshbuddy
Created August 22, 2009 23:02
Show Gist options
  • Save joshbuddy/173030 to your computer and use it in GitHub Desktop.
Save joshbuddy/173030 to your computer and use it in GitHub Desktop.
class OrOrEquals
def test
@test
end
def test=(test)
@test = test
'not test'
end
end
p (OrOrEquals.new.test = 'test')
# ruby 1.8 returns 'test'
# ruby 1.9 returns 'test'
p (OrOrEquals.new.test ||= 'test')
# ruby 1.8 returns 'test'
# ruby 1.9 returns 'not test'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment