diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-07-26 14:55:59 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-07-26 14:55:59 -0700 |
commit | 66cedcc76bf8ac97a65bf12f6b7dd2eea83ebfe3 (patch) | |
tree | 23dd908d5476990efbc42fdb81c9deb593574fca | |
parent | 82e0b8dd85a82fc9907f96bb1af849453a87b01a (diff) | |
download | rails-66cedcc76bf8ac97a65bf12f6b7dd2eea83ebfe3.tar.gz rails-66cedcc76bf8ac97a65bf12f6b7dd2eea83ebfe3.tar.bz2 rails-66cedcc76bf8ac97a65bf12f6b7dd2eea83ebfe3.zip |
reorganizing classes more
-rw-r--r-- | lib/arel.rb | 2 | ||||
-rw-r--r-- | lib/arel/algebra/relations/utilities/externalization.rb | 11 | ||||
-rw-r--r-- | lib/arel/engines/sql/relations.rb | 2 | ||||
-rw-r--r-- | lib/arel/engines/sql/relations/utilities/externalization.rb | 14 | ||||
-rw-r--r-- | lib/arel/engines/sql/relations/utilities/recursion.rb | 13 |
5 files changed, 13 insertions, 29 deletions
diff --git a/lib/arel.rb b/lib/arel.rb index 30b3faadf9..92a82b695b 100644 --- a/lib/arel.rb +++ b/lib/arel.rb @@ -3,6 +3,8 @@ require 'active_support/core_ext/class/attribute_accessors' require 'active_support/core_ext/module/delegation' require 'active_support/core_ext/object/blank' +require 'arel/recursion/base_case' + module Arel require 'arel/algebra' require 'arel/sql_literal' diff --git a/lib/arel/algebra/relations/utilities/externalization.rb b/lib/arel/algebra/relations/utilities/externalization.rb index 815e1e0aa7..8e97573f68 100644 --- a/lib/arel/algebra/relations/utilities/externalization.rb +++ b/lib/arel/algebra/relations/utilities/externalization.rb @@ -1,5 +1,7 @@ module Arel class Externalization < Compound + include Recursion::BaseCase + def == other super || Externalization === other && relation == other.relation end @@ -11,5 +13,14 @@ module Arel def attributes @attributes ||= Header.new(relation.attributes.map { |a| a.to_attribute(self) }) end + + def table_sql(formatter = Sql::TableReference.new(relation)) + formatter.select relation.compiler.select_sql, self + end + + # REMOVEME + def name + relation.name + '_external' + end end end diff --git a/lib/arel/engines/sql/relations.rb b/lib/arel/engines/sql/relations.rb index b6098a6e42..c29739ef7f 100644 --- a/lib/arel/engines/sql/relations.rb +++ b/lib/arel/engines/sql/relations.rb @@ -1,6 +1,4 @@ require 'arel/engines/sql/relations/utilities/compound' -require 'arel/engines/sql/relations/utilities/recursion' -require 'arel/engines/sql/relations/utilities/externalization' require 'arel/engines/sql/relations/utilities/nil' require 'arel/engines/sql/relations/compiler' require 'arel/engines/sql/relations/table' diff --git a/lib/arel/engines/sql/relations/utilities/externalization.rb b/lib/arel/engines/sql/relations/utilities/externalization.rb deleted file mode 100644 index a0230e90f3..0000000000 --- a/lib/arel/engines/sql/relations/utilities/externalization.rb +++ /dev/null @@ -1,14 +0,0 @@ -module Arel - class Externalization < Compound - include Recursion::BaseCase - - def table_sql(formatter = Sql::TableReference.new(relation)) - formatter.select relation.compiler.select_sql, self - end - - # REMOVEME - def name - relation.name + '_external' - end - end -end diff --git a/lib/arel/engines/sql/relations/utilities/recursion.rb b/lib/arel/engines/sql/relations/utilities/recursion.rb deleted file mode 100644 index 84a526f57c..0000000000 --- a/lib/arel/engines/sql/relations/utilities/recursion.rb +++ /dev/null @@ -1,13 +0,0 @@ -module Arel - module Recursion - module BaseCase - def table - self - end - - def table_sql(formatter = Sql::TableReference.new(self)) - formatter.table self - end - end - end -end |