generated from Saancha/ruby
-
Notifications
You must be signed in to change notification settings - Fork 1
/
book_creator.rb
32 lines (24 loc) · 860 Bytes
/
book_creator.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
require_relative 'book'
require_relative 'label_creator'
require_relative 'author_creator'
class BookCreator
def initialize
@label_creator = LabelCreator.new
@author_creator = AuthorCreator.new
end
def create_book
puts 'Please type the book title'
title = gets.chomp
# Runs the create_author method to ask our user for the author details
author = @author_creator.create_author
puts 'Please enter the publish date as YYYY-MM-DD'
publish_date = gets.chomp
puts 'Please enter the publisher name'
publisher = gets.chomp
puts 'Please enter the book condition (e.g. bad, good, new)'
cover_state = gets.chomp
# Runs the create_label method to ask our user for the label details
label = @label_creator.create_label
Book.new(title, publish_date, publisher, cover_state, author, label)
end
end