Skip to content

Instantly share code, notes, and snippets.

@robins35
Created January 4, 2019 22:50
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/bb3dbd2dcc13a72b9d2a39ba1a73fee3 to your computer and use it in GitHub Desktop.
Save robins35/bb3dbd2dcc13a72b9d2a39ba1a73fee3 to your computer and use it in GitHub Desktop.
irb(main):003:0> class Test
irb(main):004:1> def x
irb(main):005:2> @x
irb(main):006:2> end
irb(main):007:1> def x=(flag)
irb(main):008:2> false && (@x = flag)
irb(main):009:2> end
irb(main):010:1> end
=> nil
irb(main):011:0> t = Test.new
=> #<Test:0x7f22debbe308>
irb(main):012:0> t.x
=> nil
irb(main):013:0> t.x = true
=> true
irb(main):014:0> t.x
=> nil
irb(main):015:0> t.x = false
=> false
irb(main):016:0> t.x
=> nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment