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

Approvable solutions for High Scores #10

Open
emcoding opened this issue Jun 26, 2019 · 2 comments
Open

Approvable solutions for High Scores #10

emcoding opened this issue Jun 26, 2019 · 2 comments

Comments

@emcoding
Copy link

Auto-approvable:

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

  • Use attr_reader (but not attr_accessor) instead of the scores getter method.

  • In personal_top_three, the following variants can be approved immediately, but with a comment to look into max(3):

    • scores.sort.reverse.first(3),
    • scores.sort.reverse.take(3)

All other variants are not eligible for auto-approval. Including a different order of the methods.

@iHiD iHiD transferred this issue from exercism/automated-analysis Jul 3, 2019
@iHiD iHiD changed the title Approvables in Ruby: High Scores Approvable solutions for High Scores Jul 3, 2019
@iHiD
Copy link
Member

iHiD commented Jul 3, 2019

Thanks! Moving to the ruby-analyzer repo.

@emcoding
Copy link
Author

emcoding commented Aug 5, 2019

High Scores is going to change, so the solution listed will not pass the tests anymore.

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

No branches or pull requests

2 participants