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
61
62
63
64
65
66
|
# File 'lib/rubytext.rb', line 61
def debug(*args)
return unless $debugging
return unless $debug
$debug.puts *args
$debug.flush
end
|
#debugging(onoff) ⇒ Object
57
58
59
|
# File 'lib/rubytext.rb', line 57
def debugging(onoff)
$debugging = onoff
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
end
|
#import(meth, recv) ⇒ Object
FIXME lots of changes to make here…
38
39
40
41
42
|
# File 'lib/rubytext.rb', line 38
def import(meth, recv)
Kernel.module_eval do
define_method(meth) {|*args| recv.send(meth, *args) }
end
end
|
#make_exception(sym, str) ⇒ Object
44
45
46
47
48
49
50
51
52
53
|
# File 'lib/rubytext.rb', line 44
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
|