aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2010-07-20 17:07:02 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2010-07-20 17:07:02 -0700
commit5b3433069fc94e120555ae4d218f6be19d2e51d4 (patch)
tree8f322e0f730267e880ebe335bfb99d7ca642e8e5 /lib
parent2f6ae7592ff20c8ce02113f3d349b67911103023 (diff)
downloadrails-5b3433069fc94e120555ae4d218f6be19d2e51d4.tar.gz
rails-5b3433069fc94e120555ae4d218f6be19d2e51d4.tar.bz2
rails-5b3433069fc94e120555ae4d218f6be19d2e51d4.zip
removing more meta programming
Diffstat (limited to 'lib')
-rw-r--r--lib/arel/algebra/attributes/attribute.rb12
1 files changed, 10 insertions, 2 deletions
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