Sha256: ac3888862ecb08e0b37d46ffdda823e1d4d9004b4f504efe6cdfe509e7318fe9

Contents?: true

Size: 1.27 KB

Versions: 8

Compression:

Stored size: 1.27 KB

Contents

$LOAD_PATH << "lib"

require 'curses'

X = Curses  # shorthand. klunky I know

module RubyText
end

require 'version'
require 'output'       # RubyText, RubyText::Window, Kernel
require 'keys'         # RubyText::Keys
require 'menu'         # RubyText
require 'window'       # RubyText::Window
require 'color'        # RubyText, RubyText::Window
require 'effects'
require 'navigation'   # RubyText::Window
require 'settings'     # RubyText
require 'widgets'


# Skeleton... Can't put classes at top because of #initalize

module RubyText
  module Keys
  end

  class Window
  end
end

##########

at_exit { RubyText.stop }

# FIXME lots of changes to make here...

def import(meth, recv)
  Kernel.module_eval do
    define_method(meth) {|*args| recv.send(meth, *args) }
  end
end

def make_exception(sym, str)
  return if Object.constants.include?(sym)
  Object.const_set(sym, StandardError.dup)
  define_method(sym) do |*args|
    msg = str
    list = (args + [nil]*2)[0..2]
    list.each.with_index {|arg, i| msg.sub!("$#{i+1}", arg.to_s) }
    Object.class_eval(sym.to_s).new(msg)
  end
end

make_exception(:RTError, "General error: $1 $2 $3")

def debugging(onoff)
  $debugging = onoff
end

def debug(*args)
  return unless $debugging
  return unless $debug
  $debug.puts *args
  $debug.flush
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
rubytext-0.0.97 lib/rubytext.rb
rubytext-0.0.96 lib/rubytext.rb
rubytext-0.0.95 lib/rubytext.rb
rubytext-0.0.94 lib/rubytext.rb
rubytext-0.0.93 lib/rubytext.rb
rubytext-0.0.92 lib/rubytext.rb
rubytext-0.0.91 lib/rubytext.rb
rubytext-0.0.90 lib/rubytext.rb