Module: FFaker::Book

Extended by:
Book, ModuleUtils
Included in:
Book
Defined in:
lib/ffaker/book.rb

Instance Method Summary collapse

Methods included from ModuleUtils

const_missing, k, underscore

Methods included from RandomUtils

#fetch_sample, #rand, #shuffle

Instance Method Details

#authorObject



19
20
21
# File 'lib/ffaker/book.rb', line 19

def author
  FFaker::Name.name
end

#cover(slug = nil, size = '300x300', format = 'png', bgset = nil) ⇒ Object



31
32
33
# File 'lib/ffaker/book.rb', line 31

def cover(slug = nil, size = '300x300', format = 'png', bgset = nil)
  FFaker::Avatar.image(slug, size, format, bgset)
end

#description(sentence_count = 3) ⇒ Object



27
28
29
# File 'lib/ffaker/book.rb', line 27

def description(sentence_count = 3)
  FFaker::Lorem.paragraph(sentence_count)
end

#genreObject



15
16
17
# File 'lib/ffaker/book.rb', line 15

def genre
  fetch_sample(GENRES)
end

#isbnObject



23
24
25
# File 'lib/ffaker/book.rb', line 23

def isbn
  (rand(24_000_000_000) + 1_000_000_000).to_s
end

#titleObject



8
9
10
11
12
13
# File 'lib/ffaker/book.rb', line 8

def title
  case rand(2)
  when 0 then simple_title
  when 1 then title_with_prefix
  end
end