Skip to content

Instantly share code, notes, and snippets.

@ngw
Created May 30, 2019 16:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ngw/2773fa496dd5de57b36e5d3d5f95f77e to your computer and use it in GitHub Desktop.
Save ngw/2773fa496dd5de57b36e5d3d5f95f77e to your computer and use it in GitHub Desktop.
def increment_page_views(page_url, ip) │~
if @result.key?(page_url) │~
if @result[page_url].key?(ip) │~
@result[page_url][ip] = @result[page_url][ip] + 1 │~
else │~
@result[page_url][ip] = 1 │~
end │~
else │~
@result[page_url] = {ip => 1} │~
end │~
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment