class Spcap::IPAddress

Attributes

address[R]

Public Class Methods

new(address) click to toggle source
# File lib/spcap/ipaddress.rb, line 5
def initialize(address)
  @address = address
end

Public Instance Methods

<=>(other) click to toggle source

Return true if two addresses are the same address.

# File lib/spcap/ipaddress.rb, line 10
def <=>(other)
  @address <=> other.address
end
==(other) click to toggle source

Return true if two addresses are the same address.

# File lib/spcap/ipaddress.rb, line 15
def ==(other)
  @address == other.address
end
eql?(other) click to toggle source
# File lib/spcap/ipaddress.rb, line 19
def eql?(other) ; self == other ; end
hash() click to toggle source
# File lib/spcap/ipaddress.rb, line 21
def hash
  @address.hash
end
hostname() click to toggle source

Return host name correspond to this address.

# File lib/spcap/ipaddress.rb, line 26
def hostname
  # Not yet implemented
  to_num_s
end
to_i() click to toggle source

Return the value of IP address as integer.

# File lib/spcap/ipaddress.rb, line 32
def to_i
  @address.unpackt("N").first
end
to_num_s() click to toggle source

Return numerical string representation

# File lib/spcap/ipaddress.rb, line 38
def to_num_s
  @address.unpack("CCCC").join('.')
end
to_s() click to toggle source
# File lib/spcap/ipaddress.rb, line 42
def to_s
  to_num_s
end