Class: Net::IP::Route
- Inherits:
-
Object
- Object
- Net::IP::Route
- Defined in:
- lib/net/ip/route.rb,
lib/net/ip/route/parser.rb,
lib/net/ip/route/collection.rb
Overview
Class for working with routing table entries.
Defined Under Namespace
Classes: Collection, Parser
Instance Attribute Summary collapse
-
#prefix ⇒ Object
readonly
Returns the value of attribute prefix.
-
#via ⇒ Object
readonly
Returns the value of attribute via.
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ Route
constructor
Create a new route object.
- #to_params ⇒ Object
Constructor Details
#initialize(params = {}) ⇒ Route
Note:
This does NOT add the entry to the routing table. See Net::IP::Route::Collection#add for creating new routes in the routing table.
Create a new route object
14 15 16 17 18 |
# File 'lib/net/ip/route.rb', line 14 def initialize(params = {}) params.each do |k,v| instance_variable_set("@#{k}", v) end end |
Instance Attribute Details
#prefix ⇒ Object (readonly)
Returns the value of attribute prefix.
5 6 7 |
# File 'lib/net/ip/route.rb', line 5 def prefix @prefix end |
#via ⇒ Object (readonly)
Returns the value of attribute via.
5 6 7 |
# File 'lib/net/ip/route.rb', line 5 def via @via end |
Instance Method Details
#to_params ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/net/ip/route.rb', line 20 def to_params str = "" str << "via #{@via} " if @via str << "dev #{@dev} " if @dev str << "weight #{@weight}" if @weight str << " table #{@table} " if @table str << " proto #{@proto} " if @proto str << " scope #{@scope} " if @scope str << " src #{@src} " if @src str << " metric #{@metric} " if @metric str << " error #{@error}" if @error str end |