aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2010-07-28 15:25:24 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2010-07-28 15:25:24 -0700
commitea1d050266e76d0200f8ff749e537fc66c17ff4f (patch)
treeaba1651be6bf298399859acdf876faf88342fffb
parentc93f75619441cc394ce193b8af9823a5d3acf0d4 (diff)
downloadrails-ea1d050266e76d0200f8ff749e537fc66c17ff4f.tar.gz
rails-ea1d050266e76d0200f8ff749e537fc66c17ff4f.tar.bz2
rails-ea1d050266e76d0200f8ff749e537fc66c17ff4f.zip
PERF: fewer objects, using attr_reader for faster method lookup
-rw-r--r--lib/arel/algebra/relations/operations/project.rb8
1 files changed, 2 insertions, 6 deletions
diff --git a/lib/arel/algebra/relations/operations/project.rb b/lib/arel/algebra/relations/operations/project.rb
index b78d5d3e97..17431c9a82 100644
--- a/lib/arel/algebra/relations/operations/project.rb
+++ b/lib/arel/algebra/relations/operations/project.rb
@@ -1,15 +1,11 @@
module Arel
class Project < Compound
- attr_reader :projections
+ attr_reader :projections, :attributes
def initialize(relation, *projections)
super(relation)
@projections = projections.collect { |p| p.bind(relation) }
- @attributes = nil
- end
-
- def attributes
- @attributes ||= Header.new(projections).bind(self)
+ @attributes = Header.new(projections.map { |x| x.bind(self) })
end
def externalizable?