Module: TimeTravel::TimeExtensions

Defined in:
lib/time_travel/time_extensions.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/time_travel/time_extensions.rb', line 6

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

Instance Method Details

#closest_secondObject



17
18
19
# File 'lib/time_travel/time_extensions.rb', line 17

def closest_second
  Time.gm(year, month, day, hour, min, sec)
end