aboutsummaryrefslogtreecommitdiffstats
path: root/lib/arel/engines/memory/relations/array.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/arel/engines/memory/relations/array.rb')
-rw-r--r--lib/arel/engines/memory/relations/array.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/arel/engines/memory/relations/array.rb b/lib/arel/engines/memory/relations/array.rb
new file mode 100644
index 0000000000..5e7c0a4ab1
--- /dev/null
+++ b/lib/arel/engines/memory/relations/array.rb
@@ -0,0 +1,25 @@
+module Arel
+ class Array < Relation
+ attributes :array, :attribute_names
+ include Recursion::BaseCase
+ deriving :==, :initialize
+
+ def engine
+ @engine ||= Memory::Engine.new
+ end
+
+ def attributes
+ @attributes ||= @attribute_names.collect do |name|
+ name.to_attribute(self)
+ end
+ end
+
+ def format(attribute, value)
+ value
+ end
+
+ def eval
+ @array.collect { |r| Row.new(self, r) }
+ end
+ end
+end