Top Level Namespace
Defined Under Namespace
Modules: RubyText, WindowIO
Constant Summary
collapse
- Colors =
[Black, Blue, Cyan, Green, Magenta, Red, White, Yellow]
- X =
Curses
Instance Method Summary
collapse
Instance Method Details
#debug(*args) ⇒ Object
59
60
61
62
63
64
|
# File 'lib/rubytext.rb', line 59
def debug(*args)
return unless $debugging
return unless $debug
$debug.puts *args
$debug.flush
end
|
#debugging(onoff) ⇒ Object
55
56
57
|
# File 'lib/rubytext.rb', line 55
def debugging(onoff)
$debugging = onoff
end
|
#fx(str, *args, bg: nil) ⇒ Object
3
4
5
6
7
|
# File 'lib/effects.rb', line 3
def fx(str, *args, bg: nil)
eff = RubyText::Effects.new(*args, bg: bg)
str.define_singleton_method(:effect) { eff }
str end
|
#import(meth, recv) ⇒ Object
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
42
43
44
45
46
47
48
49
50
51
|
# File 'lib/rubytext.rb', line 42
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
|