Method: Cluster#authorize

Defined in:
lib/cluster.rb

#authorize(*ips) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
# File 'lib/cluster.rb', line 25

def authorize(*ips)
  if ips.empty?
    current_ip = ''
    require 'open-uri'
    open('http://checkip.dyndns.com').each do |line|
            current_ip = $1 and break if line =~ /IP Address: ([\d\.]+)</
    end
    ips << "#{current_ip}/32"
  end
  @sub.authorize(ips)
end