Skip to content

Approvable solutions for High Scores #10

Open
@emcoding

Description

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.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions