Sha256: 6fb577d90b2ad81bbf9044158ad1ed80d4b70b80ef430be4f5427f4a33dd38df

Contents?: true

Size: 580 Bytes

Versions: 1

Compression:

Stored size: 580 Bytes

Contents

require 'exception_alarm/version'
require 'exception_alarm/mpg123'

module ExceptionAlarmInclusion

  def alarm(&block)
    begin
      block.call
    rescue => e
      mpg123_command = find_executable0 ExceptionAlarm::PLAY_COMMAND
      if mpg123_command
        Thread.new do
          `#{mpg123_command} '#{File.expand_path('../alarm.mp3', __FILE__)}' &> '#{File::NULL}'`
        end
      else
        $stderr.puts ExceptionAlarm.mpg123_not_found
      end
      e.backtrace.select!{|b| !b.include?(__FILE__)}
      raise e
    end
  end

end

include ExceptionAlarmInclusion

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
exception_alarm-0.1.0 lib/exception_alarm.rb