# File lib/arel/algebra/attributes/attribute.rb, line 9
9: def initialize(relation, name, options = {})
10: @relation = relation # this is actually a table (I think)
11: @name = name
12: @alias = options[:alias]
13: @ancestor = options[:ancestor]
14: @history = [self] + (@ancestor ? @ancestor.history : [])
15: @root = @history.last
16: @original_relation = nil
17: @original_attribute = nil
18:
19: # FIXME: I think we can remove this eventually
20: @hash = name.hash + root.relation.class.hash
21: end
# File lib/arel/algebra/attributes/attribute.rb, line 90
90: def /(other)
91: other ? (history & other.history).size : 0
92: end
# File lib/arel/algebra/attributes/attribute.rb, line 31
31: def == other
32: super ||
33: Attribute === other &&
34: @name == other.name &&
35: @alias == other.alias &&
36: @ancestor == other.ancestor &&
37: @relation == other.relation
38: end
# File lib/arel/algebra/attributes/attribute.rb, line 46
46: def aggregation?
47: false
48: end
# File lib/arel/algebra/attributes/attribute.rb, line 54
54: def as(aliaz = nil)
55: Attribute.new(relation, name, :alias => aliaz, :ancestor => self)
56: end
# File lib/arel/algebra/attributes/attribute.rb, line 58
58: def bind(new_relation)
59: relation == new_relation ? self : Attribute.new(new_relation, name, :alias => @alias, :ancestor => self)
60: end
# File lib/arel/algebra/attributes/attribute.rb, line 27
27: def christener
28: @relation.christener
29: end
# File lib/arel/algebra/attributes/attribute.rb, line 86
86: def descends_from?(other)
87: history.include?(other)
88: end
# File lib/arel/algebra/attributes/attribute.rb, line 23
23: def engine
24: @relation.engine
25: end
# File lib/arel/algebra/attributes/attribute.rb, line 50
50: def eval(row)
51: row[self]
52: end
# File lib/arel/algebra/attributes/attribute.rb, line 82
82: def find_correlate_in(relation)
83: relation[self] || self
84: end
# File lib/arel/algebra/attributes/attribute.rb, line 66
66: def join?
67: relation.join?
68: end
# File lib/arel/algebra/attributes/attribute.rb, line 42
42: def named?(hypothetical_name)
43: (@alias || name).to_s == hypothetical_name.to_s
44: end
# File lib/arel/algebra/attributes/attribute.rb, line 78
78: def original_attribute
79: @original_attribute ||= history.detect { |a| !a.join? }
80: end
# File lib/arel/algebra/attributes/attribute.rb, line 74
74: def original_relation
75: @original_relation ||= original_attribute.relation
76: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.