Skip to content

Instantly share code, notes, and snippets.

@johnykov
Last active September 23, 2022 11:59
Show Gist options
  • Save johnykov/24c1c44656914e53a98e4eb9b5b53337 to your computer and use it in GitHub Desktop.
Save johnykov/24c1c44656914e53a98e4eb9b5b53337 to your computer and use it in GitHub Desktop.
ruby_book_author
class Book
attr_reader :title, :authors, :published_at
def initialize(title, authors, published_at)
@title = title
@authors = authors
@published_at = published_at
end
end
class Author
attr_reader :name
def initialize(name)
@name = name
end
end
@johnykov
Copy link
Author

johnykov commented Sep 23, 2022

Imagine you have a collection of books. books.count = 200. Write ruby code to return:

  1. author with the highest number of books
  2. list of latest published books by author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment