Class: CodeSunset::RemovalCandidateQuery

Inherits:
Object
  • Object
show all
Defined in:
lib/code_sunset/removal_candidate_query.rb

Instance Method Summary collapse

Constructor Details

#initialize(filters = {}) ⇒ RemovalCandidateQuery

Returns a new instance of RemovalCandidateQuery.



3
4
5
# File 'lib/code_sunset/removal_candidate_query.rb', line 3

def initialize(filters = {})
  @filters = filters
end

Instance Method Details

#call ⇒ Object



7
8
9
10
11
# File 'lib/code_sunset/removal_candidate_query.rb', line 7

def call
  CodeSunset::FeatureQuery.new(filters).call.select do |snapshot|
    %w[candidate_for_removal safe_to_remove].include?(snapshot.status)
  end.sort_by { |snapshot| [-snapshot.score.to_f, snapshot.feature.key] }
end