Class: FactoryHelper::Timestamps

Inherits:
Base
  • Object
show all
Defined in:
lib/factory-helper/timestamps.rb

Constant Summary

Constants inherited from Base

Base::Letters, Base::Numbers, Base::ULetters

Class Method Summary collapse

Methods inherited from Base

bothify, fetch, flexible, letterify, method_missing, numerify, parse, rand_in_range, regexify, translate

Class Method Details

.backward(from = ::Time.at(0), seconds = 60) ⇒ Object



15
16
17
18
# File 'lib/factory-helper/timestamps.rb', line 15

def backward(from = ::Time.at(0), seconds = 60)
  to = (from - seconds).round(9)
  random_time(to, from)
end

.between(from = ::Time.at(0), to = ::Time.at(2147483647)) ⇒ Object



6
7
8
# File 'lib/factory-helper/timestamps.rb', line 6

def between(from = ::Time.at(0), to = ::Time.at(2147483647))
  random_time(from, to)
end

.forward(from = ::Time.at(0), seconds = 60) ⇒ Object



10
11
12
13
# File 'lib/factory-helper/timestamps.rb', line 10

def forward(from = ::Time.at(0), seconds = 60)
  to = (from + seconds).round(9)
  random_time(from, to)
end