Top Level Namespace

Defined Under Namespace

Modules: RubyText, WindowIO

Constant Summary collapse

Colors =
[Black, Blue, Cyan, Green, Magenta, Red, White, Yellow]

Instance Method Summary collapse

Instance Method Details

#debug(*args) ⇒ Object



60
61
62
63
64
65
# File 'lib/rubytext.rb', line 60

def debug(*args)
  return unless $debugging
  return unless $debug   # FIXME eschew global?
  $debug.puts *args
  $debug.flush
end

#debugging(onoff) ⇒ Object

TODO more…



56
57
58
# File 'lib/rubytext.rb', line 56

def debugging(onoff)
  $debugging = onoff    # FIXME eschew global?
end

#fx(str, *args, bg: nil) ⇒ Object



2
3
4
5
6
# File 'lib/effects.rb', line 2

def fx(str, *args, bg: nil)
  eff = RubyText::Effects.new(*args, bg: bg)
  str.define_singleton_method(:effect) { eff } 
  str  # must return str
end

#import(meth, recv) ⇒ Object

FIXME lots of changes to make here…



36
37
38
39
40
# File 'lib/rubytext.rb', line 36

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

#make_exception(sym, str) ⇒ Object

FIXME refactor



42
43
44
45
46
47
48
49
50
51
# File 'lib/rubytext.rb', line 42

def make_exception(sym, str)   # FIXME refactor
  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