aboutsummaryrefslogtreecommitdiffstats
path: root/lib/arel/engines/memory/relations/array.rb
blob: 15a3e95e1b5ea52d13180b8ef3b79268bbe73ce0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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 eval
      @array.collect { |r| Row.new(self, r) }
    end
  end
end