Class: Clock::Substitute

Inherits:
Object
  • Object
show all
Includes:
Clock
Defined in:
lib/clock/substitute.rb

Defined Under Namespace

Classes: NullTime

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Clock

#canonize, #elapsed_milliseconds, included, local, #now, #parse, #timestamp, utc

Methods included from Now

#now

Methods included from Canonize

#canonize

Methods included from ISO8601

#precision

Methods included from Parse

#parse

Methods included from ElapsedMilliseconds

#elapsed_milliseconds

Methods included from Timestamp

#timestamp

Instance Attribute Details

#system_timeObject



7
8
9
# File 'lib/clock/substitute.rb', line 7

def system_time
  @system_time ||= NullTime.build
end

Instance Method Details

#iso8601(*args) ⇒ Object



18
19
20
21
22
23
# File 'lib/clock/substitute.rb', line 18

def iso8601(*args)
  if system_time.is_a? OpenStruct
    return super(*args)
  end
  nil
end

#now=(val) ⇒ Object



11
12
13
14
15
16
# 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