From bf6fbc4591bd7fe696f48f1db06eec714c0ec790 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Tue, 27 Jul 2010 20:33:59 -0700 Subject: PERF: reducing delegate methods --- lib/arel/algebra/attributes/attribute.rb | 9 ++++++++- lib/arel/algebra/relations/relation.rb | 4 ++++ lib/arel/engines/sql/formatters.rb | 1 + 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/arel/algebra/attributes/attribute.rb b/lib/arel/algebra/attributes/attribute.rb index 0ad9382a52..770e0950c5 100644 --- a/lib/arel/algebra/attributes/attribute.rb +++ b/lib/arel/algebra/attributes/attribute.rb @@ -4,12 +4,19 @@ module Arel class TypecastError < StandardError ; end class Attribute attr_reader :relation, :name, :alias, :ancestor - delegate :engine, :christener, :to => :relation def initialize(relation, name, options = {}) @relation, @name, @alias, @ancestor = relation, name, options[:alias], options[:ancestor] end + def engine + @relation.engine + end + + def christener + @relation.christener + end + def == other super || Attribute === other && diff --git a/lib/arel/algebra/relations/relation.rb b/lib/arel/algebra/relations/relation.rb index 9936b9689f..cb7b30bb3c 100644 --- a/lib/arel/algebra/relations/relation.rb +++ b/lib/arel/algebra/relations/relation.rb @@ -41,6 +41,10 @@ module Arel end def christener + puts "#" * 50 + puts self.class.name + puts caller + puts "#" * 50 @christener ||= Sql::Christener.new end diff --git a/lib/arel/engines/sql/formatters.rb b/lib/arel/engines/sql/formatters.rb index 2597beba95..7b0be4ea3b 100644 --- a/lib/arel/engines/sql/formatters.rb +++ b/lib/arel/engines/sql/formatters.rb @@ -4,6 +4,7 @@ module Arel attr_reader :environment, :christener def initialize(environment) + p :formatter => environment.class @environment = environment @christener = environment.christener end -- cgit v1.2.3