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
Returns a new instance of PolipusSignalHandler.
485 486 487 |
# File 'lib/polipus.rb', line 485 def initialize self.terminated = false end |
Instance Attribute Details
#terminated ⇒ Object
Returns the value of attribute terminated.
484 485 486 |
# File 'lib/polipus.rb', line 484 def terminated @terminated end |
Class Method Details
.enable ⇒ Object
489 490 491 492 493 494 495 496 497 498 |
# File 'lib/polipus.rb', line 489 def self.enable trap(:INT) { puts "Got INT signal" self.terminate } trap(:TERM) { puts "Got TERM signal" self.terminate } end |
.terminate ⇒ Object
500 501 502 |
# File 'lib/polipus.rb', line 500 def self.terminate self.instance.terminated = true end |
.terminated? ⇒ Boolean
504 505 506 |
# File 'lib/polipus.rb', line 504 def self.terminated? self.instance.terminated end |