From 3c907173bd5a1eab82e29c802cacce887ad90cde Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Wed, 21 Jul 2010 11:27:17 -0700 Subject: reuse our superclass --- lib/arel/algebra/expression.rb | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'lib/arel/algebra') diff --git a/lib/arel/algebra/expression.rb b/lib/arel/algebra/expression.rb index 875498c282..40baf5ece0 100644 --- a/lib/arel/algebra/expression.rb +++ b/lib/arel/algebra/expression.rb @@ -1,12 +1,15 @@ module Arel class Expression < Attribute - attributes :attribute, :alias, :ancestor - deriving :== - delegate :relation, :to => :attribute - alias_method :name, :alias + attr_reader :attribute + alias :name :alias def initialize(attribute, aliaz = nil, ancestor = nil) - @attribute, @alias, @ancestor = attribute, aliaz, ancestor + super(attribute.relation, aliaz, :alias => aliaz, :ancestor => ancestor) + @attribute = attribute + end + + def == other + super && Expression === other && attribute == other.attribute end def aggregation? -- cgit v1.2.3