Class: IPAddress::Prefix32
- Inherits:
-
Object
- Object
- IPAddress::Prefix32
- Defined in:
- lib/ipaddress/prefix32.rb
Class Method Summary collapse
Class Method Details
.create(num) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/ipaddress/prefix32.rb', line 11 def self.create(num) if (0 <= num && num <= 32) #static _FROM: &'static (Fn(&::prefix::Prefix, usize) -> Result<::prefix::Prefix, String>) = # &from #static _TO_IP_STR: &'static (Fn(&Vec<u16>) -> String) = &to_ip_str ip_bits = IpBits.v4() bits = ip_bits.bits return Prefix.new({ num: num, ip_bits: ip_bits, net_mask: Prefix.new_netmask(num, bits), vt_from: -> (a,b) { Prefix32.from(a,b) } #vt_to_ip_str: _TO_IP_STR, }) end return nil end |
.from(my, num) ⇒ Object
7 8 9 |
# File 'lib/ipaddress/prefix32.rb', line 7 def self.from(my, num) return Prefix32.create(num) end |