Skip to content

Instantly share code, notes, and snippets.

@crmaxx
Last active August 29, 2015 14:20
Show Gist options
  • Save crmaxx/1e6c4f83d081a5fe2879 to your computer and use it in GitHub Desktop.
Save crmaxx/1e6c4f83d081a5fe2879 to your computer and use it in GitHub Desktop.
code review
def get_endpoint(id)
endpoint = get_node_config('load-balancer', 'hostname')
begin
ip = Resolv.getaddress(endpoint)
response = open("http://#{ip}", 'HOST' => "#{id}.#{endpoint}").read
rescue StandardError
return false
end
response
end
# to
def get_endpoint(id)
endpoint = get_node_config('load-balancer', 'hostname')
ip = Resolv.getaddress(endpoint)
open("http://#{ip}", 'HOST' => "#{id}.#{endpoint}").read
rescue StandardError
return false
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment