Skip to content

Instantly share code, notes, and snippets.

@awesome
Created October 17, 2016 09:33
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save awesome/46a324b33be657699664945b7bc3d974 to your computer and use it in GitHub Desktop.
module Halp
extend self
def format_host(str)
"#{(url = URI(str)).host}#{":#{url.port}" if url.port != 80}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment