Parent

Included Modules

Files

Class Index [+]

Quicksearch

Arel::Header

Public Class Methods

new(attrs = []) click to toggle source
   # File lib/arel/algebra/header.rb, line 5
5:     def initialize(attrs = [])
6:       @attributes = attrs.to_ary
7:       @names      = {}
8:     end

Public Instance Methods

==(other) click to toggle source
    # File lib/arel/algebra/header.rb, line 22
22:     def ==(other)
23:       to_set == other.to_set
24:     end
[](key) click to toggle source
    # File lib/arel/algebra/header.rb, line 15
15:     def [](key)
16:       case key
17:       when String, Symbol then find_by_name(key)
18:       when Attribute      then find_by_attribute(key)
19:       end
20:     end
bind(relation) click to toggle source
    # File lib/arel/algebra/header.rb, line 36
36:     def bind(relation)
37:       Header.new(map { |a| a.bind(relation) })
38:     end
each() click to toggle source
    # File lib/arel/algebra/header.rb, line 10
10:     def each
11:       to_ary.each { |e| yield e }
12:       self
13:     end
index(i) click to toggle source

TMP

    # File lib/arel/algebra/header.rb, line 41
41:     def index(i)
42:       to_ary.index(i)
43:     end
to_ary() click to toggle source
    # File lib/arel/algebra/header.rb, line 32
32:     def to_ary
33:       @attributes
34:     end
union(other) click to toggle source
    # File lib/arel/algebra/header.rb, line 26
26:     def union(other)
27:       new(to_ary | other)
28:     end
Also aliased as: |
|(other) click to toggle source
Alias for: union

Private Instance Methods

find_by_attribute(attr) click to toggle source
    # File lib/arel/algebra/header.rb, line 60
60:     def find_by_attribute(attr)
61:       matching(attr).max do |a, b|
62:         (a.original_attribute / attr) <=> (b.original_attribute / attr)
63:       end
64:     end
find_by_name(name) click to toggle source
    # File lib/arel/algebra/header.rb, line 55
55:     def find_by_name(name)
56:       k = name.to_sym
57:       @names[k] ||= @attributes.detect { |a| a.named?(k) }
58:     end
matching(attribute) click to toggle source
    # File lib/arel/algebra/header.rb, line 51
51:     def matching(attribute)
52:       select { |a| !a.is_a?(Value) && a.root == attribute.root }
53:     end
new(attrs) click to toggle source
    # File lib/arel/algebra/header.rb, line 47
47:     def new(attrs)
48:       self.class.new(attrs)
49:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.