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