Skip to content

Instantly share code, notes, and snippets.

@andreacfm
Created March 29, 2012 21:14
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 andreacfm/2243873 to your computer and use it in GitHub Desktop.
Save andreacfm/2243873 to your computer and use it in GitHub Desktop.
Ruby idioms and tips

###Self Yield

Person.new do |p|
  p.name = ...
end

Object pass self to the initiliaze method as block.

class Person
	def initialize
		yield self if block_given?
	end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment