Sha256: 9bd2107d1589de9ede343485c31ce14281942e9546c049fcfb4abbf4b20f24a1

Contents?: true

Size: 1.14 KB

Versions: 6

Compression:

Stored size: 1.14 KB

Contents

#--
# Author::    Tyler Rick
# Copyright:: Copyright (c) 2007 QualitySmith, Inc.
# License::   Ruby License
# Submit to Facets?:: No.
# Deprecated. Because I discovered Kernel::abort !
#++

$LOAD_PATH << File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))
module Kernel
  def die(message, exit_code = 1)
    $stderr.puts message
    exit exit_code
  end
end

#  _____         _
# |_   _|__  ___| |_
#   | |/ _ \/ __| __|
#   | |  __/\__ \ |_
#   |_|\___||___/\__|
#
=begin test
$LOAD_PATH << File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))
require 'test/unit'
require 'rubygems'
require 'quality_extensions/kernel/capture_output'
#require 'facets/kernel/require_local'
#require_local './capture_output'

class TheTest < Test::Unit::TestCase

  def test_1
    stderr = capture_output $stderr do
      assert_raise(SystemExit) do
        die "Aggh! I'm dying!"
      end
    end
    assert_equal "Aggh! I'm dying!", stderr.chomp
  end

  def test_abort
    stderr = capture_output $stderr do
      assert_raise(SystemExit) do
        abort "Aggh! I'm dying!"
      end
    end
    assert_equal "Aggh! I'm dying!", stderr.chomp
  end

end
=end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
quality_extensions-1.1.6 lib/quality_extensions/kernel/die.rb
quality_extensions-1.1.3 lib/quality_extensions/kernel/die.rb
quality_extensions-1.1.2 lib/quality_extensions/kernel/die.rb
quality_extensions-1.1.1 lib/quality_extensions/kernel/die.rb
quality_extensions-1.1.4 lib/quality_extensions/kernel/die.rb
quality_extensions-1.1.0 lib/quality_extensions/kernel/die.rb