Class: Date
- Defined in:
- lib/propr/random/date.rb,
lib/propr/shrink/date.rb
Constant Summary collapse
- MIN =
0000-01-01
Date.jd(1721058)
- MAX =
9999-12-31
Date.jd(5373484)
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.random(options = {}, m = Propr::Random) ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/propr/random/date.rb', line 7 def random( = {}, m = Propr::Random) # These would be constants but `jd` is only defined # after `require "date"`. min = ([:min] || MIN).jd max = ([:max] || MAX).jd m.bind(Integer.random(.merge(min: min, max: max))) do |n| m.unit(jd(n)) end end |