method
in_addr
in_addr(addr)
private
Hide source
# File lib/ipaddr.rb, line 505 def in_addr(addr) case addr when Array octets = addr else m = RE_IPV4ADDRLIKE.match(addr) or return nil octets = m.captures end octets.inject(0) { |i, s| (n = s.to_i) < 256 or raise ArgumentError, "invalid address" s.match(/\A0./) and raise ArgumentError, "zero-filled number is ambiguous" i << 8 | n } end