From ea1d050266e76d0200f8ff749e537fc66c17ff4f Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Wed, 28 Jul 2010 15:25:24 -0700 Subject: PERF: fewer objects, using attr_reader for faster method lookup --- lib/arel/algebra/relations/operations/project.rb | 8 ++------ 1 file 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? -- cgit v1.2.3