Permalink
Browse files

refactored LinkRenderer#symbolized_update not to have a return statem…

…ent in the iterator
  • Loading branch information...
1 parent e8cea1b commit a27e20261a0f763ee813643073de1f911e2cb51f @mislav mislav committed Jan 12, 2009
Showing with 5 additions and 9 deletions.
  1. +5 −9 lib/will_paginate/view_helpers/link_renderer.rb
@@ -117,16 +117,12 @@ def symbolized_update(target, other)
other.each do |key, value|
key = key.to_sym
existing = target[key]
-
- if value.is_a?(Hash)
- target[key] = existing = {} if existing.nil?
- if existing.is_a?(Hash)
- symbolized_update(existing, value)
- return
- end
- end
- target[key] = value
+ if value.is_a?(Hash) and (existing.is_a?(Hash) or existing.nil?)
+ symbolized_update(existing || (target[key] = {}), value)
+ else
+ target[key] = value
+ end
end
end
end

0 comments on commit a27e202

Please sign in to comment.