Skip to content

Instantly share code, notes, and snippets.

@worker8
Created October 16, 2012 06:34
Show Gist options
  • Select an option

  • Save worker8/3897547 to your computer and use it in GitHub Desktop.

Select an option

Save worker8/3897547 to your computer and use it in GitHub Desktop.
block
class String
def perform
yield self
end
end
#=== block ====
block_string = "Hey there, "
block_string.perform do |n|
puts n + "from a block!"
end
#=== Result ===
Hey there, from a block!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment