Class: Date

Inherits:
Object
  • Object
show all
Defined in:
cybertrain/clock.rb

Overview

A class method added to Date from Ruby source (spikes/NOTES.md rule 87).

Class Method Summary collapse

Class Method Details

.current ⇒ Date

Today on Cybertrain::Clock, in Time.zone: the date of the zone’s wall clock at Time.current, so it follows travel_to in tests and turns at the zone’s midnight. Date.today stays the system’s date.

Returns:



183
184
185
186
187
# File 'cybertrain/clock.rb', line 183

def self.current
  zone = Cybertrain::Clock.zone
  wall = Cybertrain::TimeZone.epoch_to_civil(zone.utc_to_local(Cybertrain::Clock.now.to_i))
  Date.new(wall[0], wall[1], wall[2])
end