Proc object picks up the surrounding environment when it is created.
name = 'John' proc = Proc.new do name = 'Mary' end proc.call puts(name)