class Object
Constants
- Colors
- Yellow
Public Instance Methods
debug(*args)
click to toggle source
# 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)
click to toggle source
TODO more…
# File lib/rubytext.rb, line 56 def debugging(onoff) $debugging = onoff # FIXME eschew global? end
fx(str, *args, bg: nil)
click to toggle source
Helper method: insert text effects while printing
# File lib/effects.rb, line 4 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)
click to toggle source
FIXME lots of changes to make here…
# 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)
click to toggle source
# 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