From 5b3433069fc94e120555ae4d218f6be19d2e51d4 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Tue, 20 Jul 2010 17:07:02 -0700 Subject: removing more meta programming --- lib/arel/algebra/attributes/attribute.rb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/arel/algebra/attributes/attribute.rb b/lib/arel/algebra/attributes/attribute.rb index f1085aaae0..9206b228c8 100644 --- a/lib/arel/algebra/attributes/attribute.rb +++ b/lib/arel/algebra/attributes/attribute.rb @@ -3,14 +3,22 @@ require 'set' module Arel class TypecastError < StandardError ; end class Attribute - attributes :relation, :name, :alias, :ancestor - deriving :== + 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 == other + super || + Attribute === other && + @relation == other.relation && + @name == other.name && + @alias == other.alias && + @ancestor == other.ancestor + end + def named?(hypothetical_name) (@alias || name).to_s == hypothetical_name.to_s end -- cgit v1.2.3