fork download
  1. class Foo
  2.  
  3. attr_accessor :bar
  4.  
  5. def initialize
  6. yield self
  7. end
  8.  
  9. end
  10.  
  11. new_foo = Foo.new do |f|
  12. f.bar = 12345
  13. end
  14.  
  15. puts new_foo.bar
Success #stdin #stdout 0.01s 7452KB
stdin
Standard input is empty
stdout
12345