module GetIp
Constants
- JSON_IP_URL
- VERSION
Public Class Methods
local()
click to toggle source
# File lib/get_ip.rb, line 8 def self.local `ifconfig | grep -E 'inet.[0-9]' | grep -v '127.0.0.1' | awk '{ printf $2 }'` end
remote()
click to toggle source
# File lib/get_ip.rb, line 12 def self.remote resp = Net::HTTP.get_response(URI.parse(JSON_IP_URL)) data = resp.body result = JSON.parse(data) result["ip"] end