Advertisement
Guest User

Untitled

a guest
Oct 11th, 2016
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.30 KB | None | 0 0
  1. irb(main):001:0> class Foo;class << self; attr_reader :bar;def bar=(val) print "in bar"; @bar=val end end end
  2. => :bar=
  3. irb(main):002:0> Foo.bar
  4. => nil
  5. irb(main):003:0> Foo.bar={}
  6. in bar=> {}
  7. irb(main):004:0> Foo.bar
  8. => {}
  9. irb(main):005:0> Foo.bar['a']='b'
  10. => "b"
  11. irb(main):006:0> Foo.bar
  12. => {"a"=>"b"}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement