Skip to content

Commit

Permalink
Oops, I used return in an iterator block. I obviously write too much …
Browse files Browse the repository at this point in the history
…JavaScript
  • Loading branch information
mislav committed May 15, 2008
1 parent 2200673 commit 3c4725a
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions lib/will_paginate/view_helpers.rb
Expand Up @@ -356,20 +356,17 @@ def param_name
@param_name ||= @options[:param_name].to_s
end

# Recursively merge into target hash by using stringified keys from the other one
def stringified_merge(target, other)
other.each do |key, value|
key = key.to_s
key = key.to_s # this line is what it's all about!
existing = target[key]

if value.is_a?(Hash)
target[key] = existing = {} if existing.nil?
if existing.is_a?(Hash)
stringified_merge(existing, value)
return
end
if value.is_a?(Hash) and (existing.is_a?(Hash) or existing.nil?)
stringified_merge(existing || (target[key] = {}), value)
else
target[key] = value
end

target[key] = value
end
end
end
Expand Down

0 comments on commit 3c4725a

Please sign in to comment.