allow_socket?

allow_socket?(soc) Instance Public methods Allow connections from Socket soc?

bm

bm(label_width = 0, *labels) Class Public methods A simple interface to the benchmark method, bm is generates sequential reports with labels. The parameters have the same meaning as for benchmark. require 'benchmark' n = 50000 Benchmark.bm(7) do |x| x.report("for:") { for i in 1..n; a = "1"; end } x.report("times:") { n.times do ; a = "1"; end } x.report("upto:") { 1.upto(n) do ; a = "1"; end } end Generates: user system total real for:

marshal_load

marshal_load(array) Instance Public methods Loads this AnyMethod from array. For a loaded AnyMethod the following methods will return cached values: full_name parent_name

indent

indent(content, multiplier = 2) Instance Protected methods

disasm

InstructionSequence.disasm(body) â strInstructionSequence.disassemble(body) â str Class Public methods Takes body, a Method or Proc object, and returns a String with the human readable instructions for body. For a Method object: # /tmp/method.rb def hello puts "hello, world" end puts RubyVM::InstructionSequence.disasm(method(:hello)) Produces: == disasm: <RubyVM::InstructionSequence:hello@/tmp/method.rb>============ 0000 trace 8

subclasses

subclasses() Instance Public methods Returns an array with the direct children of self. Integer.subclasses # => [Fixnum, Bignum] class Foo; end class Bar < Foo; end class Baz < Bar; end Foo.subclasses # => [Bar]

insert

insert(pos, tab, keys={}) Instance Public methods

tokenize

tokenize(string) Instance Public methods Tokenize string returning the ruby object

instance_method

mod.instance_method(symbol) â unbound_method Instance Public methods Returns an UnboundMethod representing the given instance method in mod. class Interpreter def do_a() print "there, "; end def do_d() print "Hello "; end def do_e() print "!\n"; end def do_v() print "Dave"; end Dispatcher = { "a" => instance_method(:do_a), "d" => instance_method(:do_d), "e" => instance_method(:do_e), "v" => instance_method(:do_v) } def interpret(

new_proc_class

new_proc_class(klass, func, safe = 4, add = false, parent = nil, &b) Class Public methods define new proc class : If you want to modify the new class or create a new subclass, you must do such operation in the block parameter. Because the created class is flozen after evaluating the block.