Sha256: 4c204439dd6b3b7d98166deb6901f3cbb240b007ff49dc5ab2466776830dda57

Contents?: true

Size: 515 Bytes

Versions: 1

Compression:

Stored size: 515 Bytes

Contents

# coding: utf-8
# $Id: first.rb 108 2009-02-09 06:04:39Z yuyakato $

require "rubygems"
require "kagemusha"

musha = Kagemusha.new(Time)
musha.defs(:now) { self.local(1984, 5, 11) }
musha.def(:+) { |other| other }

p Time.now                #=> now
p Time.now + 60 * 60 * 24 #=> now + 24 hours
puts "---"

musha.swap {
  p Time.now                #=> 1984-05-11 00:00:00
  p Time.now + 60 * 60 * 24 #=> 86400
  puts "---"
}

p Time.now                #=> now
p Time.now + 60 * 60 * 24 #=> now + 24 hours
puts "---"

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nayutaya-kagemusha-0.0.9 examples/first.rb