Class: IFConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/ifconfig.rb

Class Method Summary collapse

Class Method Details

.myipObject



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/ifconfig.rb', line 7

def self.myip
  begin
  output = JSON.parse(Net::HTTP.get('lumtest.com', '/myip.json'))
  rescue
    if (retries += 1) <= 4
      sleep(1)
      retry
    else
      raise
    end
  end
  return output["ip"]
end