Sha256: ef146e35a9b6bfcf202ef97960a2b618c6d276822267f60d342b2f61efc549f2
Contents?: true
Size: 609 Bytes
Versions: 1
Compression:
Stored size: 609 Bytes
Contents
# -*- coding: utf-8 -*- require "date" # Date extensions class Date # @return [Date] a random daate # # This calls `DateTime#rand`. # # The default range is +/- 10000 days from now. # which is the same as `DateTime.rand` and `Time.rand`. # # @example # # Date.rand # => "2014-12-31" # # @example with a range # # today = Date.today # range = (today - 10000)..(today + 10000) # Date.rand(range) # # @param [Range<Date..Dateb>] A range of potential dates, or nil for the default. # def self.rand(range = nil) DateTime.rand(range).to_date end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sixarm_ruby_date_time_rand-2.0.2 | lib/sixarm_ruby_date_time_rand/date.rb |