1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Reuse maybe_visit method

This commit simply removes duplicated code by reusing the
existing `maybe_visit` method.
This commit is contained in:
claudiob 2014-10-23 17:22:17 -07:00
parent 7c34f82dc7
commit 08e64913d1
2 changed files with 4 additions and 18 deletions

View file

@ -69,12 +69,7 @@ module Arel
collector = inject_join o.orders, collector, ', '
end
if o.limit
collector << " "
visit(o.limit, collector)
else
collector
end
maybe_visit o.limit, collector
end
end

View file

@ -229,15 +229,9 @@ module Arel
def visit_Arel_Nodes_SelectCore o, collector
collector << "SELECT"
if o.top
collector << " "
collector = visit o.top, collector
end
maybe_visit o.top, collector
if o.set_quantifier
collector << " "
collector = visit o.set_quantifier, collector
end
maybe_visit o.set_quantifier, collector
unless o.projections.empty?
collector << SPACE
@ -271,10 +265,7 @@ module Arel
end
end
if o.having
collector << " "
collector = visit(o.having, collector)
end
maybe_visit o.having, collector
unless o.windows.empty?
collector << WINDOW