Class: Y2Network::IpoibMode

Inherits:
Object
  • Object
show all
Defined in:
src/lib/y2network/ipoib_mode.rb

Overview

This class represents the supported IPoIB transport modes.

See Also:

Constant Summary collapse

DATAGRAM =
new("datagram")
CONNECTED =
new("connected")
DEFAULT =

Not a mode at all but the default value that will be choose by the IB driver (bnc#1086454)

new("")

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ IpoibMode

Constructor


52
53
54
# File 'src/lib/y2network/ipoib_mode.rb', line 52

def initialize(name)
  @name = name
end

Instance Attribute Details

#nameString (readonly)


47
48
49
# File 'src/lib/y2network/ipoib_mode.rb', line 47

def name
  @name
end

Class Method Details

.allArray<IpoibMode>

Returns all the existing modes


31
32
33
34
35
# File 'src/lib/y2network/ipoib_mode.rb', line 31

def all
  @all ||= IpoibMode.constants
                    .map { |c| IpoibMode.const_get(c) }
                    .select { |c| c.is_a?(IpoibMode) }
end

.from_name(name) ⇒ IpoibMode?

Returns the transport mode with a given name


41
42
43
# File 'src/lib/y2network/ipoib_mode.rb', line 41

def from_name(name)
  all.find { |t| t.name == name }
end

Instance Method Details

#==(other) ⇒ Boolean Also known as: eql?

Determines whether two objects are equivalent

They are equal when they refer to the same IPoIB mode (through the name).


62
63
64
# File 'src/lib/y2network/ipoib_mode.rb', line 62

def ==(other)
  name == other.name
end