Skip to content

Instantly share code, notes, and snippets.

@buraksay
Last active July 4, 2016 15:23
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 buraksay/d7e96fc7f39951e4a7e56493ac0c58d0 to your computer and use it in GitHub Desktop.
Save buraksay/d7e96fc7f39951e4a7e56493ac0c58d0 to your computer and use it in GitHub Desktop.
def elapsed_time(method=nil, *args)
beginning_time = Time.now
if block_given?
yield
else
self.send(method, args)
end
end_time = Time.now
puts "Time elapsed #{(end_time - beginning_time)*1000} milliseconds"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment