aboutsummaryrefslogtreecommitdiffstats
path: root/lib/arel/engines/memory/relations/array.rb
diff options
context:
space:
mode:
authorEmilio Tagua <miloops@gmail.com>2009-05-26 12:41:52 -0300
committerEmilio Tagua <miloops@gmail.com>2009-05-26 12:41:52 -0300
commitc9bbea6115be520dbd47bd30108c5622289deb26 (patch)
treeec418e01954c1bd2dcfebc7fbc8220fb04b50baf /lib/arel/engines/memory/relations/array.rb
parentae1e0ac5e98a7e5a2894d0a431f8c34af6575cae (diff)
parent86364591af807ed3fa4a7304f53e6f3458cb4961 (diff)
downloadrails-c9bbea6115be520dbd47bd30108c5622289deb26.tar.gz
rails-c9bbea6115be520dbd47bd30108c5622289deb26.tar.bz2
rails-c9bbea6115be520dbd47bd30108c5622289deb26.zip
Merge commit 'brynary/master'
Conflicts: lib/arel.rb lib/arel/session.rb
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