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
452 453 454 |
# File 'lib/polipus.rb', line 452 def initialize self.terminated = false end |
Instance Attribute Details
#terminated ⇒ Object
Returns the value of attribute terminated.
451 452 453 |
# File 'lib/polipus.rb', line 451 def terminated @terminated end |
Class Method Details
.enable ⇒ Object
456 457 458 459 460 461 462 463 464 465 |
# File 'lib/polipus.rb', line 456 def self.enable trap(:INT) { puts "Got INT signal" self.terminate } trap(:TERM) { puts "Got TERM signal" self.terminate } end |
.terminate ⇒ Object
467 468 469 |
# File 'lib/polipus.rb', line 467 def self.terminate self.instance.terminated = true end |
.terminated? ⇒ Boolean
471 472 473 |
# File 'lib/polipus.rb', line 471 def self.terminated? self.instance.terminated end |