Class: Faker::Time

Inherits:
Date show all
Defined in:
lib/faker/time.rb

Constant Summary

TIME_RANGES =
{
  :all => (0..23),
  :day => (9..17),
  :night => (18..23),
  :morning => (6..11),
  :afternoon => (12..17),
  :evening => (17..21),
  :midnight => (0..4)
}

Constants inherited from Base

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

Class Method Summary collapse

Methods inherited from Date

birthday

Methods inherited from Base

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

Class Method Details

.backward(days = 365, period = :all) ⇒ Object



22
23
24
# File 'lib/faker/time.rb', line 22

def backward(days = 365, period = :all)
  super(days).to_time + random_time(period)
end

.between(from, to, period = :all) ⇒ Object



14
15
16
# File 'lib/faker/time.rb', line 14

def between(from, to, period = :all)
  super(from, to).to_time + random_time(period)
end

.forward(days = 365, period = :all) ⇒ Object



18
19
20
# File 'lib/faker/time.rb', line 18

def forward(days = 365, period = :all)
  super(days).to_time + random_time(period)
end