Module: Mockumentary::Data

Defined in:
lib/mockumentary/data.rb

Class Method Summary collapse

Class Method Details

.binaryObject



43
44
45
# File 'lib/mockumentary/data.rb', line 43

def self.binary
  Faker::Lorem.characters
end

.booleanObject



47
48
49
# File 'lib/mockumentary/data.rb', line 47

def self.boolean
  false
end

.dateObject



39
40
41
# File 'lib/mockumentary/data.rb', line 39

def self.date
  Date.today + rand(60) * (3600*24)
end

.datetimeObject



35
36
37
# File 'lib/mockumentary/data.rb', line 35

def self.datetime
  time
end

.decimalObject



19
20
21
# File 'lib/mockumentary/data.rb', line 19

def self.decimal
  rand * 100
end

.first_nameObject



51
52
53
# File 'lib/mockumentary/data.rb', line 51

def self.first_name
  Faker::Name.first_name
end

.floatObject



23
24
25
# File 'lib/mockumentary/data.rb', line 23

def self.float
  decimal
end

.full_nameObject



59
60
61
# File 'lib/mockumentary/data.rb', line 59

def self.full_name
  "#{first_name} #{last_name}"
end

.generate(key) ⇒ Object



3
4
5
# File 'lib/mockumentary/data.rb', line 3

def self.generate(key)
  self.send(key) if key.is_a?(Symbol) && respond_to?(key) 
end

.integerObject



15
16
17
# File 'lib/mockumentary/data.rb', line 15

def self.integer
  rand(100)
end

.last_nameObject



55
56
57
# File 'lib/mockumentary/data.rb', line 55

def self.last_name
  Faker::Name.last_name
end

.stringObject



7
8
9
# File 'lib/mockumentary/data.rb', line 7

def self.string
  Faker::Lorem.words.join(' ')
end

.textObject



11
12
13
# File 'lib/mockumentary/data.rb', line 11

def self.text
  Faker::Lorem.sentences.join(' ')
end

.timeObject



27
28
29
# File 'lib/mockumentary/data.rb', line 27

def self.time
  Time.now + rand(60) * (3600*24)
end

.timestampObject



31
32
33
# File 'lib/mockumentary/data.rb', line 31

def self.timestamp
  time
end