Method: App42::Command::Service#ask_source_ip

Defined in:
lib/app42/command/service.rb

#ask_source_ip(what) ⇒ Object

ask source id to user which he want to bind to service



46
47
48
49
50
51
52
53
54
55
56
# File 'lib/app42/command/service.rb', line 46

def ask_source_ip what
  ip = input "#{Message::BIND_NOTE}", [], true if what.to_s == 'bind'
  ip = input "#{Message::UNBIND_NOTE}", [], true  if what.to_s == 'unbind'
  ip_address = ip.strip
  if ip_address_valid? ip_address
    return ip_address
  else
    message "#{Message::IP_NOT_VALID}", true, 'red'
    ask_source_ip what
  end
end