Last active
September 22, 2017 19:14
-
-
Save eliavlavi/b7179610762149b05e21229b22d8bb9e to your computer and use it in GitHub Desktop.
RecommendedMovies after delegation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'delegate' | |
class RecommendedMovies < SimpleDelegator | |
def best_by_imdb | |
max_by(&:imdb_score) | |
end | |
def best_by_rotten_tomatoes | |
max_by(&:rotten_tomatoes_score) | |
end | |
def best | |
max_by(&:average_score) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment