Class: Y2Network::Route

Inherits:
Object
  • Object
show all
Includes:
Yast2::Equatable
Defined in:
src/lib/y2network/route.rb

Overview

This class represents a network route

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(to: :default, interface: nil, gateway: nil, options: "") ⇒ Route

Returns a new instance of Route.

Parameters:

  • to (IPAddr, :default) (defaults to: :default)

    Destination

  • interface (Interface, nil) (defaults to: nil)

    Interface to associate the root to

  • gateway (IPAddr, nil) (defaults to: nil)

    Gateway IP

  • options (String) (defaults to: "")

    Additional options



41
42
43
44
45
46
# File 'src/lib/y2network/route.rb', line 41

def initialize(to: :default, interface: nil, gateway: nil, options: "")
  @to = to
  @interface = interface
  @gateway = gateway
  @options = options
end

Instance Attribute Details

#gatewayIPAddr?

Returns Gateway IP address ('via' in ip route).

Returns:

  • (IPAddr, nil)

    Gateway IP address ('via' in ip route)



31
32
33
# File 'src/lib/y2network/route.rb', line 31

def gateway
  @gateway
end

#interfaceInterface?

Returns Interface to associate the route to.

Returns:

  • (Interface, nil)

    Interface to associate the route to



29
30
31
# File 'src/lib/y2network/route.rb', line 29

def interface
  @interface
end

#optionsString

Returns Additional options.

Returns:

  • (String)

    Additional options



33
34
35
# File 'src/lib/y2network/route.rb', line 33

def options
  @options
end

#toIPAddr, :default

Returns Destination; :default if it is the default route.

Returns:

  • (IPAddr, :default)

    Destination; :default if it is the default route



27
28
29
# File 'src/lib/y2network/route.rb', line 27

def to
  @to
end

Instance Method Details

#default?Boolean

Determines whether it is the default route or not

Returns:

  • (Boolean)


51
52
53
# File 'src/lib/y2network/route.rb', line 51

def default?
  to == :default
end