You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
class HighScores
attr_reader :scores
def initialize(scores)
@scores = scores
end
def personal_best
scores.max
end
def latest
scores.last
end
def personal_top_three
scores.max(3)
end
end
Approvable solution with comment (ruby.high-scores.attr_reader).
class HighScores
def initialize(scores)
@scores = scores
end
def scores
@scores
end
def personal_best
scores.max
end
def latest
scores.last
end
def personal_top_three
scores.max(3)
end
end
Approvable solution with comment (ruby.high-scores.max_not_reverse and param of {method: 'take'}).
class HighScores
def initialize(scores)
@scores = scores
end
def scores
@scores
end
def personal_best
scores.max
end
def latest
scores.last
end
def personal_top_three
scores.reverse.take(3)
end
end
Approvable solution with comment (ruby.high-scores.max_not_reverse and param of {method: 'first'}).
class HighScores
def initialize(scores)
@scores = scores
end
def scores
@scores
end
def personal_best
scores.max
end
def latest
scores.last
end
def personal_top_three
scores.reverse.first(3)
end
end
@ccare You'll want to copy/paste the two-fer scaffolding to get started, then add one solution at a time. The key to developing this is to use pry. Reach out to @kytrinyx on Slack if you'd like her to talk you through this as she explained it to me :)
The text was updated successfully, but these errors were encountered:
@ccare For you
Approvable solution without comment.
Approvable solution with comment (
ruby.high-scores.attr_reader
).Approvable solution with comment (
ruby.high-scores.max_not_reverse
and param of{method: 'take'}
).Approvable solution with comment (
ruby.high-scores.max_not_reverse
and param of{method: 'first'}
).@ccare You'll want to copy/paste the two-fer scaffolding to get started, then add one solution at a time. The key to developing this is to use
pry
. Reach out to @kytrinyx on Slack if you'd like her to talk you through this as she explained it to me :)The text was updated successfully, but these errors were encountered: