class OpengraphTransporter::GracefulQuit

Attributes

breaker[RW]

Public Class Methods

check(message = "Quitting Exporter") { || ... } click to toggle source
# File lib/opengraph_transporter/gracefulquit.rb, line 22
def check(message = "Quitting Exporter")
  if self.instance.breaker
    yield if block_given?
    puts message
    exit
  end
end
enable() { || ... } click to toggle source
# File lib/opengraph_transporter/gracefulquit.rb, line 15
def enable
  trap('INT') {
    yield if block_given?
    self.instance.breaker = true
  }
end
new() click to toggle source
# File lib/opengraph_transporter/gracefulquit.rb, line 9
def initialize
  self.breaker = false
end