Module: FFakerTW::Book
Instance Method Summary
collapse
const_missing, k, luhn_check, underscore, unique
#fetch_sample, #rand, #shuffle
Instance Method Details
#author ⇒ Object
21
22
23
|
# File 'lib/ffakerTW/book.rb', line 21
def author
FFakerTW::Name.name
end
|
#cover(slug = nil, size = '300x300', format = 'png', bgset = nil) ⇒ Object
33
34
35
|
# File 'lib/ffakerTW/book.rb', line 33
def cover(slug = nil, size = '300x300', format = 'png', bgset = nil)
FFakerTW::Avatar.image(slug, size, format, bgset)
end
|
#description(sentence_count = 3) ⇒ Object
29
30
31
|
# File 'lib/ffakerTW/book.rb', line 29
def description(sentence_count = 3)
FFakerTW::Lorem.paragraph(sentence_count)
end
|
#genre ⇒ Object
17
18
19
|
# File 'lib/ffakerTW/book.rb', line 17
def genre
fetch_sample(GENRES)
end
|
#isbn ⇒ Object
25
26
27
|
# File 'lib/ffakerTW/book.rb', line 25
def isbn
rand(1_000_000_000...25_000_000_000).to_s
end
|
#orly_cover(name = title, book_author = author, top_text = genre) ⇒ Object
37
38
39
40
41
42
43
44
|
# File 'lib/ffakerTW/book.rb', line 37
def orly_cover(name = title, book_author = author, top_text = genre)
'https://orly-appstore.herokuapp.com/generate?'\
"title=#{CGI.escape(name)}&"\
"top_text=#{CGI.escape(top_text)}&"\
"author=#{CGI.escape(book_author)}&"\
"image_code=#{Random.rand(1..40)}&"\
"theme=#{Random.rand(1..16)}"
end
|
#title ⇒ Object
10
11
12
13
14
15
|
# File 'lib/ffakerTW/book.rb', line 10
def title
case rand(0..1)
when 0 then simple_title
when 1 then title_with_prefix
end
end
|