Parent

Files

Class Index [+]

Quicksearch

Arel::Attribute

Constants

PREDICATES
Predications

Attributes

relation[R]
name[R]
alias[R]
ancestor[R]
hash[R]
history[R]

Public Class Methods

new(relation, name, options = {}) click to toggle source
    # 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

Public Instance Methods

/(other) click to toggle source
    # File lib/arel/algebra/attributes/attribute.rb, line 90
90:     def /(other)
91:       other ? (history & other.history).size : 0
92:     end
==(other) click to toggle source
    # 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
Also aliased as: eql?
aggregation?() click to toggle source
    # File lib/arel/algebra/attributes/attribute.rb, line 46
46:     def aggregation?
47:       false
48:     end
as(aliaz = nil) click to toggle source
    # 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
bind(new_relation) click to toggle source
    # 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
christener() click to toggle source
    # File lib/arel/algebra/attributes/attribute.rb, line 27
27:     def christener
28:       @relation.christener
29:     end
descends_from?(other) click to toggle source
    # File lib/arel/algebra/attributes/attribute.rb, line 86
86:     def descends_from?(other)
87:       history.include?(other)
88:     end
engine() click to toggle source
    # File lib/arel/algebra/attributes/attribute.rb, line 23
23:     def engine
24:       @relation.engine
25:     end
eql?(other) click to toggle source
Alias for: ==
eval(row) click to toggle source
    # File lib/arel/algebra/attributes/attribute.rb, line 50
50:     def eval(row)
51:       row[self]
52:     end
find_correlate_in(relation) click to toggle source
    # File lib/arel/algebra/attributes/attribute.rb, line 82
82:     def find_correlate_in(relation)
83:       relation[self] || self
84:     end
join?() click to toggle source
    # File lib/arel/algebra/attributes/attribute.rb, line 66
66:     def join?
67:       relation.join?
68:     end
named?(hypothetical_name) click to toggle source
    # 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
original_attribute() click to toggle source
    # File lib/arel/algebra/attributes/attribute.rb, line 78
78:     def original_attribute
79:       @original_attribute ||= history.detect { |a| !a.join? }
80:     end
original_relation() click to toggle source
    # File lib/arel/algebra/attributes/attribute.rb, line 74
74:     def original_relation
75:       @original_relation ||= original_attribute.relation
76:     end
root() click to toggle source
    # File lib/arel/algebra/attributes/attribute.rb, line 70
70:     def root
71:       history.last
72:     end
to_attribute(relation) click to toggle source
    # File lib/arel/algebra/attributes/attribute.rb, line 62
62:     def to_attribute(relation)
63:       bind(relation)
64:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.