Module: Arel::Attribute::Congruence
- Included in:
- Arel::Attribute
- Defined in:
- lib/arel/algebra/attributes/attribute.rb
Instance Method Summary collapse
- #/(other) ⇒ Object
- #descends_from?(other) ⇒ Boolean
- #find_correlate_in(relation) ⇒ Object
- #history ⇒ Object
- #join? ⇒ Boolean
- #original_attribute ⇒ Object
- #original_relation ⇒ Object
- #root ⇒ Object
Instance Method Details
#/(other) ⇒ Object
78 79 80 |
# File 'lib/arel/algebra/attributes/attribute.rb', line 78 def /(other) other ? (history & other.history).size : 0 end |
#descends_from?(other) ⇒ Boolean
74 75 76 |
# File 'lib/arel/algebra/attributes/attribute.rb', line 74 def descends_from?(other) history.include?(other) end |
#find_correlate_in(relation) ⇒ Object
70 71 72 |
# File 'lib/arel/algebra/attributes/attribute.rb', line 70 def find_correlate_in(relation) relation[self] || self end |
#history ⇒ Object
50 51 52 |
# File 'lib/arel/algebra/attributes/attribute.rb', line 50 def history @history ||= [self] + (ancestor ? ancestor.history : []) end |
#join? ⇒ Boolean
54 55 56 |
# File 'lib/arel/algebra/attributes/attribute.rb', line 54 def join? relation.join? end |
#original_attribute ⇒ Object
66 67 68 |
# File 'lib/arel/algebra/attributes/attribute.rb', line 66 def original_attribute @original_attribute ||= history.detect { |a| !a.join? } end |
#original_relation ⇒ Object
62 63 64 |
# File 'lib/arel/algebra/attributes/attribute.rb', line 62 def original_relation @original_relation ||= original_attribute.relation end |
#root ⇒ Object
58 59 60 |
# File 'lib/arel/algebra/attributes/attribute.rb', line 58 def root history.last end |