Class: Socket::Ifaddr

Inherits:
Data
  • Object
show all
Defined in:
lib/socket/ifaddr.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(addr: nil, broadaddr: nil, dstaddr: nil, flags: nil, ifindex: nil, name: nil, netmask: nil) ⇒ Ifaddr

Returns a new instance of Ifaddr.



5
6
7
8
9
10
11
12
13
# File 'lib/socket/ifaddr.rb', line 5

def initialize(addr: nil, broadaddr: nil, dstaddr: nil, flags: nil, ifindex: nil, name: nil, netmask: nil)
  @addr      = addr
  @broadaddr = broadaddr
  @dstaddr   = dstaddr
  @flags     = flags
  @ifindex   = ifindex
  @name      = name
  @netmask   = netmask
end

Instance Attribute Details

#addrObject (readonly)

Returns the value of attribute addr.



3
4
5
# File 'lib/socket/ifaddr.rb', line 3

def addr
  @addr
end

#broadaddrObject (readonly)

Returns the value of attribute broadaddr.



3
4
5
# File 'lib/socket/ifaddr.rb', line 3

def broadaddr
  @broadaddr
end

#dstaddrObject (readonly)

Returns the value of attribute dstaddr.



3
4
5
# File 'lib/socket/ifaddr.rb', line 3

def dstaddr
  @dstaddr
end

#flagsObject (readonly)

Returns the value of attribute flags.



3
4
5
# File 'lib/socket/ifaddr.rb', line 3

def flags
  @flags
end

#ifindexObject (readonly)

Returns the value of attribute ifindex.



3
4
5
# File 'lib/socket/ifaddr.rb', line 3

def ifindex
  @ifindex
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/socket/ifaddr.rb', line 3

def name
  @name
end

#netmaskObject (readonly)

Returns the value of attribute netmask.



3
4
5
# File 'lib/socket/ifaddr.rb', line 3

def netmask
  @netmask
end

Instance Method Details

#inspectObject



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/socket/ifaddr.rb', line 15

def inspect
  out = "#<Socket::Ifaddr #{name}"

  if addr
    out << " #{addr.inspect_sockaddr}"
  end

  if netmask
    out << " netmask=#{netmask.inspect_sockaddr}"
  end

  out + '>'
end