Created
March 31, 2010 14:39
-
-
Save j1n3l0/350409 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
class Foo | |
attr_accessor :bar | |
def initialize | |
@bar = "bar" | |
yield( self ) if block_given? | |
return self | |
end | |
end | |
foo = Foo.new { |s| s.bar = "baz" } | |
puts foo.bar # prints baz |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment