Class: Ml::CandidatesCsvPresenter

Inherits:
Object
  • Object
show all
Defined in:
app/presenters/ml/candidates_csv_presenter.rb

Constant Summary collapse

CANDIDATE_ASSOCIATIONS =
[:latest_metrics, :params, :experiment].freeze
TARGET_FILESIZE =

This file size limit is mainly to avoid the generation to hog resources from the server. The value is arbitrary can be update once we have better insight into usage.

2.megabytes

Instance Method Summary collapse

Constructor Details

#initialize(candidates) ⇒ CandidatesCsvPresenter

Returns a new instance of CandidatesCsvPresenter.



10
11
12
# File 'app/presenters/ml/candidates_csv_presenter.rb', line 10

def initialize(candidates)
  @candidates = candidates
end

Instance Method Details

#presentObject



14
15
16
# File 'app/presenters/ml/candidates_csv_presenter.rb', line 14

def present
  CsvBuilder.new(@candidates, headers, CANDIDATE_ASSOCIATIONS).render(TARGET_FILESIZE)
end