diff options
Diffstat (limited to 'lib/arel/engines/memory/relations')
-rw-r--r-- | lib/arel/engines/memory/relations/array.rb | 6 | ||||
-rw-r--r-- | lib/arel/engines/memory/relations/compound.rb | 2 | ||||
-rw-r--r-- | lib/arel/engines/memory/relations/operations.rb | 16 | ||||
-rw-r--r-- | lib/arel/engines/memory/relations/writes.rb | 4 |
4 files changed, 14 insertions, 14 deletions
diff --git a/lib/arel/engines/memory/relations/array.rb b/lib/arel/engines/memory/relations/array.rb index 6e2dc29252..5e7c0a4ab1 100644 --- a/lib/arel/engines/memory/relations/array.rb +++ b/lib/arel/engines/memory/relations/array.rb @@ -3,7 +3,7 @@ module Arel attributes :array, :attribute_names include Recursion::BaseCase deriving :==, :initialize - + def engine @engine ||= Memory::Engine.new end @@ -17,9 +17,9 @@ module Arel def format(attribute, value) value end - + def eval @array.collect { |r| Row.new(self, r) } end end -end
\ No newline at end of file +end diff --git a/lib/arel/engines/memory/relations/compound.rb b/lib/arel/engines/memory/relations/compound.rb index 9e7827dfb3..6dda92a6a1 100644 --- a/lib/arel/engines/memory/relations/compound.rb +++ b/lib/arel/engines/memory/relations/compound.rb @@ -1,7 +1,7 @@ module Arel class Compound < Relation delegate :array, :to => :relation - + def unoperated_rows relation.call.collect { |row| row.bind(self) } end diff --git a/lib/arel/engines/memory/relations/operations.rb b/lib/arel/engines/memory/relations/operations.rb index e0fd2824b3..8e01938360 100644 --- a/lib/arel/engines/memory/relations/operations.rb +++ b/lib/arel/engines/memory/relations/operations.rb @@ -4,7 +4,7 @@ module Arel unoperated_rows.select { |row| predicate.eval(row) } end end - + class Order < Compound def eval unoperated_rows.sort do |row1, row2| @@ -13,37 +13,37 @@ module Arel end end end - + class Project < Compound def eval unoperated_rows.collect { |r| r.slice(*projections) } end end - + class Take < Compound def eval unoperated_rows[0, taken] end end - + class Skip < Compound def eval unoperated_rows[skipped..-1] end end - + class Group < Compound def eval raise NotImplementedError end end - + class Alias < Compound def eval unoperated_rows end end - + class Join < Relation def eval result = [] @@ -58,4 +58,4 @@ module Arel result end end -end
\ No newline at end of file +end diff --git a/lib/arel/engines/memory/relations/writes.rb b/lib/arel/engines/memory/relations/writes.rb index fa8b84a32c..12c4f36c0d 100644 --- a/lib/arel/engines/memory/relations/writes.rb +++ b/lib/arel/engines/memory/relations/writes.rb @@ -1,7 +1,7 @@ module Arel class Insert < Compound def eval - unoperated_rows + [Row.new(self, record.values.collect(&:value))] + unoperated_rows + [Row.new(self, record.values.collect(&:value))] end end -end
\ No newline at end of file +end |