Sha256: 9b782af15a743dbae9369f97999f18e466e844a5c18a02e5585e2f2cb289c78a

Contents?: true

Size: 1.15 KB

Versions: 1

Compression:

Stored size: 1.15 KB

Contents

# = Navel Software Technology
#
# code: gmosx, drak, ekarak
#
# (c) 2001-2004 Navel, all rights reserved.
# $Id: std.rb 71 2004-10-18 10:50:22Z gmosx $

# we want readable code

require "English"
require "pp"

class NilClass
	# to_i, to_s are handled by default.
	
	def to_i
		return nil
	end
	
	def to_f
		return 0.0
	end
	
	# quite usefull for error tolerant apps.
	# a bit dangerous though.
	#
	def empty?
		return true
	end
end

#
#
class Class
	def to_i()
		return self.hash()
	end
end

#
#
module Kernel
	# pretty prints an exception/error object
	# usefull for helpfull debug messages
	#
	# Input:
	# The Exception/StandardError object
	#
	# Output:
	# the pretty printed string
	#
	def pp_exception(ex)
		return %{#{ex.message}\n\tBACKTRACE:\n\t#{ex.backtrace.join("\n\t")}\n\tLOGGED FROM:\n\t#{caller[0]}}
	end

end

# predefine some comonly used objects

EMPTY_STRING = ""

# This the default 72 chars separator, copy paste to use it
# in your source file. Btw all lines in your source file should 
# be less than 72 chars. So you can use this as a ruler if your 
# editor does not support it.

#-----------------------------------------------------------------------


Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nitro-0.1.2 lib/n/std.rb