Skip to content

Instantly share code, notes, and snippets.

@KevinFerm
Created March 20, 2015 09:42
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KevinFerm/918787e1fa00895b54c1 to your computer and use it in GitHub Desktop.
Save KevinFerm/918787e1fa00895b54c1 to your computer and use it in GitHub Desktop.
Bad function
helper_method :get_completion
def get_completion(user)
if user.name
done = {}
comp = JSON.parse(user.completion)
if comp.length > 0
comp.each do |catkey,catval|
if catkey
done[catkey] = {}
if catval
catval.each do |stepkey,stepval|
done[catkey][stepkey] = stepval
end
end
end
end
return done
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment