Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add auto-approval for high scores #13

Open
iHiD opened this issue Jul 6, 2019 · 0 comments
Open

Add auto-approval for high scores #13

iHiD opened this issue Jul 6, 2019 · 0 comments
Assignees

Comments

@iHiD
Copy link
Member

iHiD commented Jul 6, 2019

@ccare For you

Approvable solution without comment.

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 :)

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

No branches or pull requests

2 participants