web/app/models/compare_query.rb
author Marcel Hlopko <marcel.hlopko@gmail.com>
Sun, 23 Jun 2013 11:22:20 +0200
changeset 91 d430a8ac253d
child 106 eac4098d544d
permissions -rw-r--r--
comparison page kinda works

class CompareQuery
  include ActiveModel::Model

  attr_accessor :benchmark_id, :implementations

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

  def filtered_implementations
    LanguageImplementation.where(id: impls_to_array_of_ids)
  end

  def benchmark_info
    BenchmarkInfo.find(benchmark_id)
  end

  private

  def impls_to_array_of_ids
    implementations.keys
  end
end