module Kernel

Public Instance Methods

call_stack( depth = 1 ) click to toggle source
# File lib/antlr3/test/call-stack.rb, line 46
def call_stack( depth = 1 )
  Call.convert_backtrace( caller( depth + 1 ) )
end
screen_width( out=STDERR ) click to toggle source
# File lib/antlr3/test/core-extensions.rb, line 161
def screen_width( out=STDERR )
  default_width = ENV[ 'COLUMNS' ] || 80
  tiocgwinsz = 0x5413
  data = [ 0, 0, 0, 0 ].pack( "SSSS" )
  if out.ioctl( tiocgwinsz, data ) >= 0 then
    rows, cols, xpixels, ypixels = data.unpack( "SSSS" )
    if cols >= 0 then cols else default_width end
  else
    default_width
  end
rescue Exception => e
  default_width rescue ( raise e )
end