From b0eb6244122a5fd86beaaabb6381835aebb139d4 Mon Sep 17 00:00:00 2001 From: Nick Kallen Date: Mon, 18 Feb 2008 11:31:14 -0800 Subject: rename __collect__ to descend since the double underscores were ugly. --- lib/active_relation/predicates.rb | 6 +++--- lib/active_relation/relations/aggregation.rb | 4 ++-- lib/active_relation/relations/alias.rb | 4 ++-- lib/active_relation/relations/compound.rb | 2 +- lib/active_relation/relations/join.rb | 6 +++--- lib/active_relation/relations/order.rb | 4 ++-- lib/active_relation/relations/projection.rb | 4 ++-- lib/active_relation/relations/range.rb | 4 ++-- lib/active_relation/relations/relation.rb | 2 +- lib/active_relation/relations/rename.rb | 4 ++-- lib/active_relation/relations/selection.rb | 4 ++-- 11 files changed, 22 insertions(+), 22 deletions(-) (limited to 'lib') diff --git a/lib/active_relation/predicates.rb b/lib/active_relation/predicates.rb index 880412fdb5..67d910b9d1 100644 --- a/lib/active_relation/predicates.rb +++ b/lib/active_relation/predicates.rb @@ -17,11 +17,11 @@ module ActiveRelation end def bind(relation) - __collect__{ |x| x.bind(relation) } + descend{ |x| x.bind(relation) } end def qualify - __collect__(&:qualify) + descend(&:qualify) end def to_sql(strategy = Sql::Predicate.new) @@ -29,7 +29,7 @@ module ActiveRelation end protected - def __collect__ + def descend self.class.new(yield(attribute), yield(operand)) end end diff --git a/lib/active_relation/relations/aggregation.rb b/lib/active_relation/relations/aggregation.rb index bcdfaa7d53..de21d2f383 100644 --- a/lib/active_relation/relations/aggregation.rb +++ b/lib/active_relation/relations/aggregation.rb @@ -22,8 +22,8 @@ module ActiveRelation end protected - def __collect__(&block) - Aggregation.new(relation.__collect__(&block), :expressions => expressions.collect(&block), :groupings => groupings.collect(&block)) + def descend(&block) + Aggregation.new(relation.descend(&block), :expressions => expressions.collect(&block), :groupings => groupings.collect(&block)) end end end \ No newline at end of file diff --git a/lib/active_relation/relations/alias.rb b/lib/active_relation/relations/alias.rb index cc6e9b09b8..0bfa895951 100644 --- a/lib/active_relation/relations/alias.rb +++ b/lib/active_relation/relations/alias.rb @@ -10,8 +10,8 @@ module ActiveRelation self[attribute] and @alias end - def __collect__(&block) - Alias.new(relation.__collect__(&block), @alias) + def descend(&block) + Alias.new(relation.descend(&block), @alias) end def ==(other) diff --git a/lib/active_relation/relations/compound.rb b/lib/active_relation/relations/compound.rb index a02fbbeef5..2839862987 100644 --- a/lib/active_relation/relations/compound.rb +++ b/lib/active_relation/relations/compound.rb @@ -10,7 +10,7 @@ module ActiveRelation end def qualify - __collect__(&:qualify) + descend(&:qualify) end end end \ No newline at end of file diff --git a/lib/active_relation/relations/join.rb b/lib/active_relation/relations/join.rb index a5d2b5355b..6185293c8a 100644 --- a/lib/active_relation/relations/join.rb +++ b/lib/active_relation/relations/join.rb @@ -15,7 +15,7 @@ module ActiveRelation end def qualify - __collect__(&:qualify) + descend(&:qualify) end def attributes @@ -49,8 +49,8 @@ module ActiveRelation relation1.aggregation?? relation1.to_sql(Sql::Aggregation.new) : relation1.send(:table_sql) end - def __collect__(&block) - Join.new(join_sql, relation1.__collect__(&block), relation2.__collect__(&block), *predicates.collect(&block)) + def descend(&block) + Join.new(join_sql, relation1.descend(&block), relation2.descend(&block), *predicates.collect(&block)) end end end \ No newline at end of file diff --git a/lib/active_relation/relations/order.rb b/lib/active_relation/relations/order.rb index 90568a90ac..cee6278c80 100644 --- a/lib/active_relation/relations/order.rb +++ b/lib/active_relation/relations/order.rb @@ -12,8 +12,8 @@ module ActiveRelation end protected - def __collect__(&block) - Order.new(relation.__collect__(&block), *orders.collect(&block)) + def descend(&block) + Order.new(relation.descend(&block), *orders.collect(&block)) end end end \ No newline at end of file diff --git a/lib/active_relation/relations/projection.rb b/lib/active_relation/relations/projection.rb index 3fb594e2bb..cd08a5aa54 100644 --- a/lib/active_relation/relations/projection.rb +++ b/lib/active_relation/relations/projection.rb @@ -17,8 +17,8 @@ module ActiveRelation end protected - def __collect__(&block) - Projection.new(relation.__collect__(&block), *projections.collect(&block)) + def descend(&block) + Projection.new(relation.descend(&block), *projections.collect(&block)) end end end \ No newline at end of file diff --git a/lib/active_relation/relations/range.rb b/lib/active_relation/relations/range.rb index 5cc5db094d..14a86b8c65 100644 --- a/lib/active_relation/relations/range.rb +++ b/lib/active_relation/relations/range.rb @@ -20,8 +20,8 @@ module ActiveRelation end protected - def __collect__(&block) - Range.new(relation.__collect__(&block), range) + def descend(&block) + Range.new(relation.descend(&block), range) end end end \ No newline at end of file diff --git a/lib/active_relation/relations/relation.rb b/lib/active_relation/relations/relation.rb index 1c48d8be02..7d33b42faf 100644 --- a/lib/active_relation/relations/relation.rb +++ b/lib/active_relation/relations/relation.rb @@ -104,7 +104,7 @@ module ActiveRelation alias_method :to_s, :to_sql protected - def __collect__ + def descend yield self end diff --git a/lib/active_relation/relations/rename.rb b/lib/active_relation/relations/rename.rb index 718dbfe30f..1705d9ba8c 100644 --- a/lib/active_relation/relations/rename.rb +++ b/lib/active_relation/relations/rename.rb @@ -19,8 +19,8 @@ module ActiveRelation end protected - def __collect__(&block) - Rename.new(relation.__collect__(&block), yield(attribute) => pseudonym) + def descend(&block) + Rename.new(relation.descend(&block), yield(attribute) => pseudonym) end private diff --git a/lib/active_relation/relations/selection.rb b/lib/active_relation/relations/selection.rb index 93e0e16dc5..f8cd235419 100644 --- a/lib/active_relation/relations/selection.rb +++ b/lib/active_relation/relations/selection.rb @@ -18,8 +18,8 @@ module ActiveRelation relation.send(:selects) + [predicate] end - def __collect__(&block) - Selection.new(relation.__collect__(&block), yield(predicate)) + def descend(&block) + Selection.new(relation.descend(&block), yield(predicate)) end end -- cgit v1.2.3