From 34303cc6176f47c1359a2fca8f50365e601509f0 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Fri, 30 Jul 2010 19:05:41 -0700 Subject: [PATCH] removing module for faster method lookup --- lib/arel/algebra/expression.rb | 23 ++++++++----------- .../unit/primitives/expression_spec.rb | 2 +- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/lib/arel/algebra/expression.rb b/lib/arel/algebra/expression.rb index 5a93ca97..f7ba57a7 100644 --- a/lib/arel/algebra/expression.rb +++ b/lib/arel/algebra/expression.rb @@ -20,20 +20,17 @@ def to_sql(formatter = Sql::SelectClause.new(relation)) formatter.expression self end - module Transformations - def as(aliaz) - self.class.new(attribute, aliaz, self) - end - - def bind(new_relation) - new_relation == relation ? self : self.class.new(attribute.bind(new_relation), @alias, self) - end - - def to_attribute(relation) - Attribute.new(relation, @alias, :ancestor => self) - end + def as(aliaz) + self.class.new(attribute, aliaz, self) + end + + def bind(new_relation) + new_relation == relation ? self : self.class.new(attribute.bind(new_relation), @alias, self) + end + + def to_attribute(relation) + Attribute.new(relation, @alias, :ancestor => self) end - include Transformations end class Count < Expression diff --git a/spec/algebra/unit/primitives/expression_spec.rb b/spec/algebra/unit/primitives/expression_spec.rb index 483817f7..f95ef69f 100644 --- a/spec/algebra/unit/primitives/expression_spec.rb +++ b/spec/algebra/unit/primitives/expression_spec.rb @@ -7,7 +7,7 @@ module Arel @attribute = @relation[:id] end - describe Expression::Transformations do + describe 'Expression::Transformations' do before do @expression = Count.new(@attribute) end