Top Level Namespace

Defined Under Namespace

Modules: NoANSI, WithANSI Classes: RuneBlog

Instance Method Summary collapse

Instance Method Details

#curses?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/global.rb', line 20

def curses?
  true
end

#dump(obj, name) ⇒ Object

FIXME scope



95
96
97
# File 'lib/helpers-blog.rb', line 95

def dump(obj, name)      # FIXME scope
  File.write(name, obj)
end

#make_exception(sym, str) ⇒ Object



24
25
26
27
28
29
30
31
32
# File 'lib/global.rb', line 24

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

#prefix(num) ⇒ Object



34
35
36
# File 'lib/global.rb', line 34

def prefix(num)
  "#{'%04d' % num.to_i}"
end