Created
April 3, 2012 19:51
-
-
Save denysonique/2295111 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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