diff options
author | Bryan Helmkamp <bryan@brynary.com> | 2009-05-17 14:20:29 -0400 |
---|---|---|
committer | Bryan Helmkamp <bryan@brynary.com> | 2009-05-17 14:24:06 -0400 |
commit | bdca9ed42ffea10aa6989ea3ecebedb424fa01ed (patch) | |
tree | 80682aa1c8fe544f1e91ccb8c529e66c8a1ddc94 /lib/arel/engines/array | |
parent | 2bbf8ca9d2af3ea959a21c3729b4894bc31f088b (diff) | |
download | rails-bdca9ed42ffea10aa6989ea3ecebedb424fa01ed.tar.gz rails-bdca9ed42ffea10aa6989ea3ecebedb424fa01ed.tar.bz2 rails-bdca9ed42ffea10aa6989ea3ecebedb424fa01ed.zip |
moved sql related code to its own engine area
Conflicts:
lib/arel/engine.rb
lib/arel/extensions/object.rb
lib/arel/predicates.rb
lib/arel/primitives/attribute.rb
lib/arel/primitives/expression.rb
lib/arel/primitives/value.rb
lib/arel/relations/operations/join.rb
lib/arel/relations/relation.rb
lib/arel/relations/utilities/externalization.rb
lib/arel/relations/utilities/nil.rb
lib/arel/relations/writes/delete.rb
lib/arel/relations/writes/insert.rb
lib/arel/relations/writes/update.rb
spec/arel/unit/relations/skip_spec.rb
spec/arel/unit/relations/take_spec.rb
spec/spec_helper.rb
Diffstat (limited to 'lib/arel/engines/array')
-rw-r--r-- | lib/arel/engines/array/array.rb | 1 | ||||
-rw-r--r-- | lib/arel/engines/array/relations/array.rb | 19 |
2 files changed, 20 insertions, 0 deletions
diff --git a/lib/arel/engines/array/array.rb b/lib/arel/engines/array/array.rb new file mode 100644 index 0000000000..3a3a47308a --- /dev/null +++ b/lib/arel/engines/array/array.rb @@ -0,0 +1 @@ +require 'arel/engines/array/relations/array'
\ No newline at end of file diff --git a/lib/arel/engines/array/relations/array.rb b/lib/arel/engines/array/relations/array.rb new file mode 100644 index 0000000000..dac65abbc2 --- /dev/null +++ b/lib/arel/engines/array/relations/array.rb @@ -0,0 +1,19 @@ +module Arel + class Array < Relation + include Recursion::BaseCase + + def initialize(array, attribute_names) + @array, @attribute_names = array, attribute_names + end + + def attributes + @attributes ||= @attribute_names.collect do |name| + Attribute.new(self, name.to_sym) + end + end + + def call(connection = nil) + @array.collect { |row| attributes.zip(row).to_hash } + end + end +end
\ No newline at end of file |