web/app/models/compare_query.rb
author Marcel Hlopko <marcel.hlopko@gmail.com>
Tue, 25 Jun 2013 22:11:10 +0200
changeset 106 eac4098d544d
parent 91 d430a8ac253d
child 111 28dccacb2bc1
permissions -rw-r--r--
huge refactoring to better fit what we agreed on

class CompareQuery
  include ActiveModel::Model

  attr_accessor :benchmark_id, :runtimes

  def initialize(*args)
    super
    @runtimes ||= {}
  end

  def filtered_runtimes
    Runtime.where(id: runtimes_to_array_of_ids)
  end

  def benchmark_info
    BenchmarkInfo.find(benchmark_id)
  end

  private

  def runtimes_to_array_of_ids
    runtimes.keys
  end
end