diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-08-06 14:05:56 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-08-06 14:05:56 -0700 |
commit | c86f94986d60d607f374ef01f9b6428fc64ddc81 (patch) | |
tree | 4ca5334586657fad4b8fde6efed825d4a138a096 /lib/arel/algebra | |
parent | 12ba765448582cb86e5f57d6befc42c59eb295d9 (diff) | |
download | rails-c86f94986d60d607f374ef01f9b6428fc64ddc81.tar.gz rails-c86f94986d60d607f374ef01f9b6428fc64ddc81.tar.bz2 rails-c86f94986d60d607f374ef01f9b6428fc64ddc81.zip |
unfactoring module inclusion
Diffstat (limited to 'lib/arel/algebra')
-rw-r--r-- | lib/arel/algebra/attributes/attribute.rb | 49 |
1 files changed, 23 insertions, 26 deletions
diff --git a/lib/arel/algebra/attributes/attribute.rb b/lib/arel/algebra/attributes/attribute.rb index 2a4b274a96..5b391f86b0 100644 --- a/lib/arel/algebra/attributes/attribute.rb +++ b/lib/arel/algebra/attributes/attribute.rb @@ -58,40 +58,37 @@ module Arel bind(relation) end - module Congruence - def history - @history ||= [self] + (ancestor ? ancestor.history : []) - end + def history + @history ||= [self] + (ancestor ? ancestor.history : []) + end - def join? - relation.join? - end + def join? + relation.join? + end - def root - history.last - end + def root + history.last + end - def original_relation - @original_relation ||= original_attribute.relation - end + def original_relation + @original_relation ||= original_attribute.relation + end - def original_attribute - @original_attribute ||= history.detect { |a| !a.join? } - end + def original_attribute + @original_attribute ||= history.detect { |a| !a.join? } + end - def find_correlate_in(relation) - relation[self] || self - end + def find_correlate_in(relation) + relation[self] || self + end - def descends_from?(other) - history.include?(other) - end + def descends_from?(other) + history.include?(other) + end - def /(other) - other ? (history & other.history).size : 0 - end + def /(other) + other ? (history & other.history).size : 0 end - include Congruence PREDICATES = [ :eq, :eq_any, :eq_all, :not_eq, :not_eq_any, :not_eq_all, :lt, :lt_any, |