web/app/models/compare_query.rb
changeset 91 d430a8ac253d
child 106 eac4098d544d
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/app/models/compare_query.rb	Sun Jun 23 11:22:20 2013 +0200
@@ -0,0 +1,24 @@
+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