class
Ruby latest stable (v2_5_5)
-
0 notes
- Superclass:
Object
- 1_8_6_287
- 1_8_7_72
- 1_8_7_330
- 1_9_1_378
- 1_9_2_180 (0)
- 1_9_3_125 (0)
- 1_9_3_392 (0)
- 2_1_10 (38)
- 2_2_9 (0)
- 2_4_6 (0)
- 2_5_5 (0)
- 2_6_3 (0)
- What's this?
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?
Constants
INSPECTORS = {}