Skip to content

Instantly share code, notes, and snippets.

@denysonique
Created April 3, 2012 19:51
Show Gist options
  • Save denysonique/2295111 to your computer and use it in GitHub Desktop.
Save denysonique/2295111 to your computer and use it in GitHub Desktop.
$sessions = {}
class Test
def initialize(session, &blk)
$last_session = session
yield
end
end
class User
def initialize
$sessions[to_s] = $last_session
end
def self.find(id)
User.new
end
def say_hey
puts "hey from session #{$sessions[to_s]}"
end
end
Test.new('test1') do
User.find(1).say_hey
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment