Class: OnetableTerminator::Core
- Inherits:
-
Object
- Object
- OnetableTerminator::Core
- Defined in:
- lib/onetable_terminator/core.rb
Instance Attribute Summary collapse
-
#exec ⇒ Object
readonly
Returns the value of attribute exec.
-
#rules_handler ⇒ Object
readonly
Returns the value of attribute rules_handler.
Instance Method Summary collapse
-
#initialize(dry_run = false) ⇒ Core
constructor
A new instance of Core.
- #run ⇒ Object
Constructor Details
#initialize(dry_run = false) ⇒ Core
5 6 7 8 |
# File 'lib/onetable_terminator/core.rb', line 5 def initialize(dry_run = false) @exec = OnetableTerminator::Iptables::Exec.new dry_run @rules_handler = OnetableTerminator::Iptables::RulesHandler.new end |
Instance Attribute Details
#exec ⇒ Object (readonly)
Returns the value of attribute exec.
3 4 5 |
# File 'lib/onetable_terminator/core.rb', line 3 def exec @exec end |
#rules_handler ⇒ Object (readonly)
Returns the value of attribute rules_handler.
3 4 5 |
# File 'lib/onetable_terminator/core.rb', line 3 def rules_handler @rules_handler end |
Instance Method Details
#run ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/onetable_terminator/core.rb', line 10 def run rules = retrieve_redundant_rules if rules.empty? logger.debug 'Found no redundant rules, nothing to delete' return end log_redundant_rules rules delete_redundant_rules rules end |