Created
November 21, 2008 13:25
-
-
Save mrkn/27437 to your computer and use it in GitHub Desktop.
This file contains 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
require 'rubygems' | |
require 'kagemusha' | |
musha = Kagemusha.new(Time) | |
musha.defs(:now) { self.local(1984, 5, 11) } | |
musha.def(:+) {|other| other } | |
def foo | |
puts "enter foo" | |
p Time.now | |
p Time.now + 60 * 60 * 24 | |
puts "leave foo" | |
end | |
foo | |
musha.swap { | |
puts "enter musha.swap" | |
p Time.now | |
p Time.now + 60 * 60 * 24 | |
foo | |
puts "leave musha.swap" | |
} | |
## enter foo | |
## Fri Nov 21 22:24:27 +0900 2008 | |
## Sat Nov 22 22:24:27 +0900 2008 | |
## leave foo | |
## enter musha.swap | |
## Fri May 11 00:00:00 +0900 1984 | |
## 86400 | |
## enter foo | |
## Fri May 11 00:00:00 +0900 1984 | |
## 86400 | |
## leave foo | |
## leave musha.swap |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment