Class: Polipus::PolipusSignalHandler
- Inherits:
-
Object
- Object
- Polipus::PolipusSignalHandler
- Includes:
- Singleton
- Defined in:
- lib/polipus.rb
Instance Attribute Summary collapse
-
#terminated ⇒ Object
Returns the value of attribute terminated.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ PolipusSignalHandler
constructor
A new instance of PolipusSignalHandler.
Constructor Details
#initialize ⇒ PolipusSignalHandler
439 440 441 |
# File 'lib/polipus.rb', line 439 def initialize self.terminated = false end |
Instance Attribute Details
#terminated ⇒ Object
Returns the value of attribute terminated.
438 439 440 |
# File 'lib/polipus.rb', line 438 def terminated @terminated end |
Class Method Details
.enable ⇒ Object
443 444 445 446 447 448 449 450 451 452 |
# File 'lib/polipus.rb', line 443 def self.enable trap(:INT) { puts "Got INT signal" self.terminate } trap(:TERM) { puts "Got TERM signal" self.terminate } end |
.terminate ⇒ Object
454 455 456 |
# File 'lib/polipus.rb', line 454 def self.terminate self.instance.terminated = true end |
.terminated? ⇒ Boolean
458 459 460 |
# File 'lib/polipus.rb', line 458 def self.terminated? self.instance.terminated end |