class Library::Library
Attributes
books[R]
name[R]
Public Class Methods
new(name, address)
click to toggle source
# File lib/library/library.rb, line 8 def initialize(name, address) @name = name.split.map(&:capitalize).join(' ') @address = address.split.map(&:capitalize).join(' ') @books =[] end
Public Instance Methods
add_book(book)
click to toggle source
# File lib/library/library.rb, line 14 def add_book(book) @books << book end
find_book(book_title)
click to toggle source
# File lib/library/library.rb, line 22 def find_book(book_title) return_book = nil @books.each do |book| if book.name.upcase == book_title.upcase return_book = book end end return return_book end
show_books_in_library()
click to toggle source
# File lib/library/library.rb, line 32 def show_books_in_library @books.each do |book| puts book.show_book_details end end
to_s()
click to toggle source
# File lib/library/library.rb, line 18 def to_s "#{@name} library is located at #{@address}, #{@name}" end