net-ip 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -17,6 +17,20 @@ module Net
17
17
  end
18
18
  end
19
19
 
20
+ def to_h
21
+ h = {}
22
+ h[:prefix] = @prefix if @prefix
23
+ h[:via] = @via if @via
24
+ h[:dev] = @dev if @dev
25
+ h[:weight] = @weight if @weight
26
+ h[:proto] = @proto if @proto
27
+ h[:scope] = @scope if @scope
28
+ h[:src] = @src if @src
29
+ h[:metric] = @metric if @metric
30
+ h[:error] = @error if @error
31
+ h
32
+ end
33
+
20
34
  def to_params
21
35
  str = ""
22
36
  str << "via #{@via} " if @via
@@ -49,7 +49,8 @@ module Net
49
49
  # @param route {Route} Route to add to the table.
50
50
  # @return {void}
51
51
  def add(route)
52
- result = `ip route add table #{@table} #{route.to_params}`
52
+ cmd = "ip route add table #{@table} #{route.prefix} #{route.to_params}"
53
+ result = `#{cmd}`
53
54
  raise result unless $?.success?
54
55
  end
55
56
 
@@ -1,5 +1,5 @@
1
1
  module Net
2
2
  module IP
3
- VERSION = "0.0.7"
3
+ VERSION = "0.0.8"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: net-ip
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-08-16 00:00:00.000000000 Z
12
+ date: 2013-08-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -106,7 +106,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
106
106
  version: '0'
107
107
  segments:
108
108
  - 0
109
- hash: -2536851174243620573
109
+ hash: 1110750811572201111
110
110
  required_rubygems_version: !ruby/object:Gem::Requirement
111
111
  none: false
112
112
  requirements:
@@ -115,7 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
115
115
  version: '0'
116
116
  segments:
117
117
  - 0
118
- hash: -2536851174243620573
118
+ hash: 1110750811572201111
119
119
  requirements: []
120
120
  rubyforge_project:
121
121
  rubygems_version: 1.8.25