Sha256: 560ed11c537dc4082758b24ab64f7696fa530e228c11ab58489fd4328fefe7e9

Contents?: true

Size: 343 Bytes

Versions: 1

Compression:

Stored size: 343 Bytes

Contents

module ValidatesHost
  class Subnet
    def initialize(subnet)
      @subnet = subnet
    end

    def valid?
      return true if @subnet.blank?
      @subnet =~ /^([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}\/(2[4-9]|30)$/
    end

    def subnet
      @subnet
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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