Skip to content

Instantly share code, notes, and snippets.

@andreacfm
Created July 23, 2014 15:45
Show Gist options
  • Save andreacfm/956b2bb8711bb574e5ad to your computer and use it in GitHub Desktop.
Save andreacfm/956b2bb8711bb574e5ad to your computer and use it in GitHub Desktop.
lambda env construct
class Pippo
attr_accessor :name
def initialize
greet(&greeter)
end
def greet &block
p block.call(self)
end
def greeter
-> env {
env.name = 'Andrea'
}
end
end
a = Pippo.new # 'Andrea'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment