Type:
Class
Constants:
INSPECTORS : {}

Default inspectors available to irb, this includes:

:pp

Using Kernel#pretty_inspect

:yaml

Using YAML.dump

:marshal

Using Marshal.dump

An irb inspector

In order to create your own custom inspector there are two things you should be aware of:

Inspector uses inspect_value, or inspect_proc, for output of return values.

This also allows for an optional init+, or init_proc, which is called when the inspector is activated.

Knowing this, you can create a rudimentary inspector as follows:

irb(main):001:0> ins = IRB::Inspector.new(proc{ |v| "omg! #{v}" })
irb(main):001:0> IRB.CurrentContext.inspect_mode = ins # => omg! #<IRB::Inspector:0x007f46f7ba7d28>
irb(main):001:0> "what?" #=> omg! what?
init

init() Instance Public methods Proc

2015-04-14 03:55:59
keys_with_inspector

keys_with_inspector(inspector) Class Public methods Determines the inspector

2015-04-14 03:48:17
def_inspector

def_inspector(key, arg=nil, &block) Class Public methods Example

2015-04-14 03:41:54
inspect_value

inspect_value(v) Instance Public methods

2015-04-14 03:59:59
new

new(inspect_proc, init_proc = nil) Class Public methods Creates a new inspector

2015-04-14 03:49:28