improved some example descriptions

This commit is contained in:
Adam Meehan
2008-07-26 00:16:51 +10:00
parent 79460dc39b
commit 9e689746f3
5 changed files with 67 additions and 3 deletions

View File

@@ -0,0 +1,33 @@
require 'time'
module TimeTravel
module TimeExtensions
def self.included(base)
base.extend(ClassMethods)
base.class_eval do
class << self
alias_method :immutable_now, :now
alias_method :now, :mutable_now
end
end
base.now = nil
end
module ClassMethods
@@now = nil
def now=(time)
time = Time.parse(time) if time.instance_of?(String)
@@now = time
end
def mutable_now #:nodoc:
@@now || immutable_now
end
end
end
end