diff options
author | Nick Kallen <nkallen@nick-kallens-computer-2.local> | 2008-02-24 17:26:32 -0800 |
---|---|---|
committer | Nick Kallen <nkallen@nick-kallens-computer-2.local> | 2008-02-24 17:26:32 -0800 |
commit | ecd072d21951573f59e9515b868224d3732dbdfa (patch) | |
tree | b58b2c8e14c991206b2989f5478476cc9d7419c9 /lib | |
parent | 51fdd769c0cb096d6e6f04afc3ebb91833d625bc (diff) | |
download | rails-ecd072d21951573f59e9515b868224d3732dbdfa.tar.gz rails-ecd072d21951573f59e9515b868224d3732dbdfa.tar.bz2 rails-ecd072d21951573f59e9515b868224d3732dbdfa.zip |
renamed attribute to operand per josh's suggestion
Diffstat (limited to 'lib')
-rw-r--r-- | lib/active_relation/predicates.rb | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/lib/active_relation/predicates.rb b/lib/active_relation/predicates.rb index c4f7b83512..7d0618f42e 100644 --- a/lib/active_relation/predicates.rb +++ b/lib/active_relation/predicates.rb @@ -6,14 +6,15 @@ module ActiveRelation end class Binary < Predicate - attr_reader :attribute, :operand + # rename "operand21", "operand22" + attr_reader :operand1, :operand2 - def initialize(attribute, operand) - @attribute, @operand = attribute, operand + def initialize(operand1, operand2) + @operand1, @operand2 = operand1, operand2 end def ==(other) - super and @attribute == other.attribute and @operand == other.operand + super and @operand1 == other.operand1 and @operand2 == other.operand2 end def bind(relation) @@ -25,19 +26,19 @@ module ActiveRelation end def to_sql(strategy = Sql::Predicate.new) - "#{attribute.to_sql(strategy)} #{predicate_sql} #{operand.to_sql(strategy)}" + "#{operand1.to_sql(strategy)} #{predicate_sql} #{operand2.to_sql(strategy)}" end def descend - self.class.new(yield(attribute), yield(operand)) + self.class.new(yield(operand1), yield(operand2)) end end class Equality < Binary def ==(other) self.class == other.class and - ((attribute == other.attribute and operand == other.operand) or - (attribute == other.operand and operand == other.attribute)) + ((operand1 == other.operand1 and operand2 == other.operand2) or + (operand1 == other.operand2 and operand2 == other.operand1)) end protected @@ -75,15 +76,15 @@ module ActiveRelation end class Match < Binary - alias_method :regexp, :operand + alias_method :regexp, :operand2 - def initialize(attribute, regexp) - @attribute, @regexp = attribute, regexp + def initialize(operand1, regexp) + @operand1, @regexp = operand1, regexp end end class RelationInclusion < Binary - alias_method :relation, :operand + alias_method :relation, :operand2 protected def predicate_sql |