class Clock::Substitute

Attributes

system_time[W]

Public Class Methods

null_time() click to toggle source
# File lib/clock/substitute.rb, line 25
def self.null_time
  Mimic.(Object) do
    def method_missing(*)
    end
  end
end

Public Instance Methods

iso8601(time=nil, precision: nil) click to toggle source
Calls superclass method Clock#iso8601
# File lib/clock/substitute.rb, line 18
def iso8601(time=nil, precision: nil)
  if system_time.is_a? OpenStruct
    return super(time, precision: precision)
  end
  nil
end
method_missing(*) click to toggle source
# File lib/clock/substitute.rb, line 27
def method_missing(*)
end
now=(val) click to toggle source
# File lib/clock/substitute.rb, line 11
def now=(val)
  system_time = OpenStruct.new
  system_time.now = val
  self.system_time = system_time
  system_time
end
system_time() click to toggle source
# File lib/clock/substitute.rb, line 7
def system_time
  @system_time ||= self.class.null_time
end