lib/net/ip/route.rb in net-ip-0.0.7 vs lib/net/ip/route.rb in net-ip-0.0.8

- old
+ new

@@ -15,9 +15,23 @@ params.each do |k,v| instance_variable_set("@#{k}", v) end end + def to_h + h = {} + h[:prefix] = @prefix if @prefix + h[:via] = @via if @via + h[:dev] = @dev if @dev + h[:weight] = @weight if @weight + h[:proto] = @proto if @proto + h[:scope] = @scope if @scope + h[:src] = @src if @src + h[:metric] = @metric if @metric + h[:error] = @error if @error + h + end + def to_params str = "" str << "via #{@via} " if @via str << "dev #{@dev} " if @dev str << "weight #{@weight}" if @weight