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.rb11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/arel/engines/memory/relations/array.rb b/lib/arel/engines/memory/relations/array.rb
index 5e7c0a4ab1..577e327b19 100644
--- a/lib/arel/engines/memory/relations/array.rb
+++ b/lib/arel/engines/memory/relations/array.rb
@@ -1,16 +1,21 @@
module Arel
class Array < Relation
- attributes :array, :attribute_names
+ attributes :array, :attribute_names_and_types
include Recursion::BaseCase
deriving :==, :initialize
+ def initialize(array, attribute_names_and_types)
+ @array, @attribute_names_and_types = array, attribute_names_and_types
+ end
+
def engine
@engine ||= Memory::Engine.new
end
def attributes
- @attributes ||= @attribute_names.collect do |name|
- name.to_attribute(self)
+ @attributes ||= @attribute_names_and_types.collect do |attribute, type|
+ attribute = type.new(self, attribute) if Symbol === attribute
+ attribute
end
end