Skip to content

Instantly share code, notes, and snippets.

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

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

Select an option

Save worker8/3897598 to your computer and use it in GitHub Desktop.
lambda
class String
def perform code
code.call(self)
end
end
#===lambda method====
lambda_string = "Hey there, "
lambda_code = lambda do |n|
puts n + "from a lambda!"
end
lambda_string.perform lambda_code
#=== Result ===
Hey there, from a lambda!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment