Skip to content

Instantly share code, notes, and snippets.

@robins35
Created January 4, 2019 22:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robins35/f446778a0e5dec454977bf035adf7dde to your computer and use it in GitHub Desktop.
Save robins35/f446778a0e5dec454977bf035adf7dde to your computer and use it in GitHub Desktop.
irb(main):001:0> RUBY_VERSION
=> "2.5.1"
irb(main):002:0> class Test
irb(main):003:1> def x; @x; end
irb(main):004:1> def x=(val); false && (x = val); end
irb(main):005:1> end
=> :x=
irb(main):006:0> t = Test.new
=> #<Test:0x00005570a2c46310>
irb(main):007:0> t.x
=> nil
irb(main):008:0> t.x = "HI THERE"
=> "HI THERE"
irb(main):009:0> t.x
=> nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment