Class: DateTime
- Inherits:
-
Object
- Object
- DateTime
- Defined in:
- lib/sixarm_ruby_date_time_rand/date_time.rb
Overview
DateTime extensions
Class Method Summary collapse
-
.rand(range = nil) ⇒ DateTime
This is called by
Date.randandTime.rand.
Class Method Details
.rand(range = nil) ⇒ DateTime
This is called by Date.rand and Time.rand.
The default range is +/- 10000 days from now, which is the same as Date.rand and Time.rand.
29 30 31 |
# File 'lib/sixarm_ruby_date_time_rand/date_time.rb', line 29 def self.rand(range = nil) range ? Kernel.rand(range) : (DateTime.now + Kernel.rand(-10000..10000)) end |