Class: Rule
- Inherits:
-
Object
- Object
- Rule
- Defined in:
- lib/rule/rule.rb
Class Attribute Summary collapse
-
.commands ⇒ Object
readonly
Returns the value of attribute commands.
Class Method Summary collapse
Class Attribute Details
.commands ⇒ Object (readonly)
Returns the value of attribute commands.
5 6 7 |
# File 'lib/rule/rule.rb', line 5 def commands @commands end |
Class Method Details
.build_commands(isps = []) ⇒ Object
7 8 9 10 11 12 13 14 |
# File 'lib/rule/rule.rb', line 7 def build_commands(isps=[]) @commands = [] isps.each do |isp| output = `/sbin/ip rule show` @commands << "/sbin/ip rule add from #{isp.ip_address} table #{isp.name}" unless output.include?(isp.name) end @commands end |