Sha256: dcdf45f2fc7f1c9c2b5b1f9ba23f3bc362ca70e250cb634bfd80e8ba276967c3

Contents?: true

Size: 298 Bytes

Versions: 1

Compression:

Stored size: 298 Bytes

Contents

module ValidatesHost
  class Ip
    def initialize(ip)
      @ip = ip
    end

    def valid?
      return true if @ip.blank?
      @ip =~ /^([1-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\.([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])){3}$/
    end

    def ip
      @ip
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
validates_host-1.0.0 lib/validates_host/ip.rb