diff options
author | Carl Lerche <carllerche@mac.com> | 2010-03-22 16:26:00 -0700 |
---|---|---|
committer | Carl Lerche <carllerche@mac.com> | 2010-03-22 16:26:00 -0700 |
commit | 30fb25d3abfc002b85f290587b979d54c35a2e98 (patch) | |
tree | 5ea4b427f6abed9d9be1f45ad449b14e35271095 /lib/arel/algebra | |
parent | d0b47c64e2c44ef1cc0e9cfb3dc8681599d4d1f3 (diff) | |
download | rails-30fb25d3abfc002b85f290587b979d54c35a2e98.tar.gz rails-30fb25d3abfc002b85f290587b979d54c35a2e98.tar.bz2 rails-30fb25d3abfc002b85f290587b979d54c35a2e98.zip |
Switch Arel::Relation to a module. This will allow for classes with Relation extended on them to represent relations themselves (as opposed to their instances being relations).
Diffstat (limited to 'lib/arel/algebra')
-rw-r--r-- | lib/arel/algebra/relations/operations/join.rb | 6 | ||||
-rw-r--r-- | lib/arel/algebra/relations/relation.rb | 2 | ||||
-rw-r--r-- | lib/arel/algebra/relations/utilities/compound.rb | 4 | ||||
-rw-r--r-- | lib/arel/algebra/relations/utilities/externalization.rb | 2 | ||||
-rw-r--r-- | lib/arel/algebra/relations/utilities/nil.rb | 4 |
5 files changed, 11 insertions, 7 deletions
diff --git a/lib/arel/algebra/relations/operations/join.rb b/lib/arel/algebra/relations/operations/join.rb index df457686cc..300cd31bcd 100644 --- a/lib/arel/algebra/relations/operations/join.rb +++ b/lib/arel/algebra/relations/operations/join.rb @@ -1,5 +1,7 @@ module Arel - class Join < Relation + class Join + include Relation + attributes :relation1, :relation2, :predicates deriving :== delegate :name, :to => :relation1 @@ -60,7 +62,7 @@ module Arel end end - class Relation + module Relation def join? false end diff --git a/lib/arel/algebra/relations/relation.rb b/lib/arel/algebra/relations/relation.rb index 51c622cbe8..1c1ded15c9 100644 --- a/lib/arel/algebra/relations/relation.rb +++ b/lib/arel/algebra/relations/relation.rb @@ -1,5 +1,5 @@ module Arel - class Relation + module Relation attr_reader :count def session diff --git a/lib/arel/algebra/relations/utilities/compound.rb b/lib/arel/algebra/relations/utilities/compound.rb index 0734842b27..7039b82575 100644 --- a/lib/arel/algebra/relations/utilities/compound.rb +++ b/lib/arel/algebra/relations/utilities/compound.rb @@ -1,5 +1,7 @@ module Arel - class Compound < Relation + class Compound + include Relation + attr_reader :relation delegate :joins, :join?, :inserts, :taken, :skipped, :name, :externalizable?, :column_for, :engine, :sources, :locked, :table_alias, diff --git a/lib/arel/algebra/relations/utilities/externalization.rb b/lib/arel/algebra/relations/utilities/externalization.rb index 13758ccec9..795a3919f2 100644 --- a/lib/arel/algebra/relations/utilities/externalization.rb +++ b/lib/arel/algebra/relations/utilities/externalization.rb @@ -12,7 +12,7 @@ module Arel end end - class Relation + module Relation def externalize @externalized ||= externalizable?? Externalization.new(self) : self end diff --git a/lib/arel/algebra/relations/utilities/nil.rb b/lib/arel/algebra/relations/utilities/nil.rb index 6a9d678c45..04055d0ddb 100644 --- a/lib/arel/algebra/relations/utilities/nil.rb +++ b/lib/arel/algebra/relations/utilities/nil.rb @@ -1,7 +1,7 @@ require 'singleton' module Arel - class Nil < Relation - include Singleton + class Nil + include Relation, Singleton end end |