app/models/forms/script.rb
def ip_valid?
      return true if ip.blank?
      IPAddr.new(ip.strip, Socket::AF_INET) && true
    rescue IPAddr::InvalidAddressError, IPAddr::AddressFamilyError
      errors.add(:ip, :invalid)
      false
    end
# validate that ip is a valid IPV4 address
# @return [Binary] true or false
validate that ip is a valid IPV4 address
validate that ip is a valid IPV4 address
def ip_valid?
      return true if ip.blank?
      IPAddr.new(ip.strip, Socket::AF_INET) && true
    rescue IPAddr::InvalidAddressError, IPAddr::AddressFamilyError
      errors.add(:ip, :invalid)
      false
    end
def ip_valid? return true if ip . blank? IPAddr . new ( ip . strip , Socket :: AF_INET ) && true rescue IPAddr :: InvalidAddressError , IPAddr :: AddressFamilyError errors . add ( :ip , :invalid ) false end
validate that ip is a valid IPV4 address
validate that ip is a valid IPV4 address
true or false
true or false
Binary