Class: Y2Network::Route
- Inherits:
-
Object
- Object
- Y2Network::Route
- Defined in:
- src/lib/y2network/route.rb
Overview
This class represents a network route
Instance Attribute Summary collapse
-
#gateway ⇒ IPAddr?
Gateway IP address ('via' in ip route).
-
#interface ⇒ Interface?
Interface to associate the route to.
-
#options ⇒ String
Additional options.
-
#to ⇒ IPAddr, :default
Destination; :default if it is the default route.
Instance Method Summary collapse
-
#==(other) ⇒ Boolean
(also: #eql?)
Determines whether two routes are equal.
-
#default? ⇒ Boolean
Determines whether it is the default route or not.
-
#initialize(to: :default, interface: nil, gateway: nil, options: "") ⇒ Route
constructor
A new instance of Route.
Constructor Details
#initialize(to: :default, interface: nil, gateway: nil, options: "") ⇒ Route
35 36 37 38 39 40 |
# File 'src/lib/y2network/route.rb', line 35 def initialize(to: :default, interface: nil, gateway: nil, options: "") @to = to @interface = interface @gateway = gateway = end |
Instance Attribute Details
#gateway ⇒ IPAddr?
27 28 29 |
# File 'src/lib/y2network/route.rb', line 27 def gateway @gateway end |
#interface ⇒ Interface?
25 26 27 |
# File 'src/lib/y2network/route.rb', line 25 def interface @interface end |
#options ⇒ String
29 30 31 |
# File 'src/lib/y2network/route.rb', line 29 def end |
#to ⇒ IPAddr, :default
23 24 25 |
# File 'src/lib/y2network/route.rb', line 23 def to @to end |
Instance Method Details
#==(other) ⇒ Boolean Also known as: eql?
Determines whether two routes are equal
53 54 55 56 |
# File 'src/lib/y2network/route.rb', line 53 def ==(other) to == other.to && interface == other.interface && gateway == other.gateway && == other. end |
#default? ⇒ Boolean
Determines whether it is the default route or not
45 46 47 |
# File 'src/lib/y2network/route.rb', line 45 def default? to == :default end |