End of Life Ruby 3.2 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
Object#xmp
xmp(exps, bind = nil)
lib/irb/xmp.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.2.0/lib/irb/xmp.rb, line 165
def xmp(exps, bind = nil)
bind = IRB::Frame.top(1) unless bind
xmp = XMP.new(bind)
xmp.puts exps
xmp
end
A convenience method that’s only available when the you require the IRB::XMP standard library.
Creates a new XMP object, using the given expressions as the exps parameter, and optional binding as bind or uses the top-level binding. Then evaluates the given expressions using the :XMP prompt mode.
For example:
Example
require 'irb/xmp' ctx = binding xmp 'foo = "bar"', ctx #=> foo = "bar" #==>"bar" ctx.eval 'foo' #=> "bar"
See XMP.new for more information.