Sha256: f8dd027cb0420cd663ce4794daeb5ff75a09491300cf4401523701ab4b05d5c1
Contents?: true
Size: 875 Bytes
Versions: 5
Compression:
Stored size: 875 Bytes
Contents
require 'date' module Tins module DateTimeDummy def self.included(modul) class << modul alias really_now now remove_method :now rescue nil def dummy=(value) if value.respond_to?(:to_str) value = DateTime.parse(value.to_str) end @dummy = value end def dummy(value = nil) if value.nil? @dummy else begin old_dummy = @dummy self.dummy = value yield ensure self.dummy = old_dummy end end end def now if dummy dummy.dup elsif caller.first =~ /`now`/ really_now else really_now end end end super end end end require 'tins/alias'
Version data entries
5 entries across 5 versions & 1 rubygems