APIdock / Ruby
/
Browse About
method

inspect

v1_9_3_125 - Show latest stable - Class: IPAddr
inspect()
public

Returns a string containing a human-readable representation of the ipaddr. (“# family:address/mask>”)

# File lib/ipaddr.rb, line 377
  def inspect
    case @family
    when Socket::AF_INET
      af = "IPv4"
    when Socket::AF_INET6
      af = "IPv6"
    else
      raise "unsupported address family"
    end
    return sprintf("#<%s: %s:%s/%s>", self.class.name,
                   af, _to_string(@addr), _to_string(@mask_addr))
  end

Related methods

  • Instance methods
  • &
  • <<
  • <=>
  • ==
  • ===
  • >>
  • eql?
  • hash
  • hton
  • include?
  • inspect
  • ip6_arpa
  • ip6_int
  • ipv4?
  • ipv4_compat
  • ipv4_compat?
  • ipv4_mapped
  • ipv4_mapped?
  • ipv6?
  • mask
  • native
  • reverse
  • succ
  • to_i
  • to_range
  • to_s
  • to_string
  • |
  • ~
  • Class methods
  • new
  • new_ntoh
  • ntop
  • Protected methods
  • protectedmask!
  • protectedset
  • Private methods
  • private_reverse
  • private_to_string
  • privateaddr_mask
  • privatecoerce_other
  • privatein6_addr
  • privatein_addr
APIdock API Documentation Browser

© 2026 APIdock