Module: Mockumentary::Data
- Defined in:
- lib/mockumentary/data.rb
Class Method Summary collapse
- .binary ⇒ Object
- .boolean ⇒ Object
- .date ⇒ Object
- .datetime ⇒ Object
- .decimal ⇒ Object
- .first_name ⇒ Object
- .float ⇒ Object
- .full_name ⇒ Object
- .generate(key) ⇒ Object
- .integer ⇒ Object
- .last_name ⇒ Object
- .string ⇒ Object
- .text ⇒ Object
- .time ⇒ Object
- .timestamp ⇒ Object
Class Method Details
.binary ⇒ Object
43 44 45 |
# File 'lib/mockumentary/data.rb', line 43 def self.binary Faker::Lorem.characters end |
.boolean ⇒ Object
47 48 49 |
# File 'lib/mockumentary/data.rb', line 47 def self.boolean false end |
.date ⇒ Object
39 40 41 |
# File 'lib/mockumentary/data.rb', line 39 def self.date Date.today + rand(60) * (3600*24) end |
.datetime ⇒ Object
35 36 37 |
# File 'lib/mockumentary/data.rb', line 35 def self.datetime time end |
.decimal ⇒ Object
19 20 21 |
# File 'lib/mockumentary/data.rb', line 19 def self.decimal rand * 100 end |
.first_name ⇒ Object
51 52 53 |
# File 'lib/mockumentary/data.rb', line 51 def self.first_name Faker::Name.first_name end |
.float ⇒ Object
23 24 25 |
# File 'lib/mockumentary/data.rb', line 23 def self.float decimal end |
.full_name ⇒ Object
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 |
.integer ⇒ Object
15 16 17 |
# File 'lib/mockumentary/data.rb', line 15 def self.integer rand(100) end |
.last_name ⇒ Object
55 56 57 |
# File 'lib/mockumentary/data.rb', line 55 def self.last_name Faker::Name.last_name end |
.string ⇒ Object
7 8 9 |
# File 'lib/mockumentary/data.rb', line 7 def self.string Faker::Lorem.words.join(' ') end |
.text ⇒ Object
11 12 13 |
# File 'lib/mockumentary/data.rb', line 11 def self.text Faker::Lorem.sentences.join(' ') end |
.time ⇒ Object
27 28 29 |
# File 'lib/mockumentary/data.rb', line 27 def self.time Time.now + rand(60) * (3600*24) end |
.timestamp ⇒ Object
31 32 33 |
# File 'lib/mockumentary/data.rb', line 31 def self. time end |