Flowdock
in6_addr(left) private

No documentation

This method has no description. You can help the Ruby community by adding new notes.

Hide source
# File lib/ipaddr.rb, line 539
  def in6_addr(left)
    case left
    when /^::ffff:(\d+\.\d+\.\d+\.\d+)$/
      return in_addr($1) + 0xffff00000000
    when /^::(\d+\.\d+\.\d+\.\d+)$/
      return in_addr($1)
    when /[^0-9a-f:]/
      raise ArgumentError, "invalid address"
    when /^(.*)::(.*)$/
      left, right = $1, $2
    else
      right = ''
    end
    l = left.split(':')
    r = right.split(':')
    rest = 8 - l.size - r.size
    if rest < 0
      return nil
    end
    return (l + Array.new(rest, '0') + r).inject(0) { |i, s|
      i << 16 | s.hex
    }
  end
Register or log in to add new notes.