Sha256: f21fff506ff2f2b99dc7060b6f3cc4c338991a3010c8e29eb5e065210c281357

Contents?: true

Size: 979 Bytes

Versions: 1

Compression:

Stored size: 979 Bytes

Contents

require_relative 'prefix'
require_relative 'ip_bits'

class IPAddress
  class Prefix128
    # #[derive(Ord,PartialOrd,Eq,PartialEq,Debug,Copy,Clone)]
    # pub struct Prefix128 {
    # }
    #
    # impl Prefix128 {
    #
    #  Creates a new prefix object for 128 bits IPv6 addresses
    #
    #    prefix = IPAddressPrefix128.new 64
    #      # => 64
    #
    ##[allow(unused_comparisons)]
    def self.create(num)
      if (num <= 128)
        #static _FROM: &'static (Fn(&Prefix, usize) -> Result<Prefix, String>) = &from
        #static _TO_IP_STR: &'static (Fn(&Vec<u16>) -> String) = &Prefix128::to_ip_str
        ip_bits = IpBits.v6()
        bits = ip_bits.bits
        return Prefix.new({
          num: num,
          ip_bits: ip_bits,
          net_mask: Prefix.new_netmask(num, bits),
          vt_from: ->(a,b) { Prefix128.from(a,b) }
        })
      end

      return nil
    end

    def self.from(my, num)
      return Prefix128.create(num)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
construqt-ipaddress-2.0.1 lib/ipaddress/prefix128.rb