Class: Object (Ruby 2.3.4)


Public Instance Methods


frozen_string_literal: false DO NOT WRITE ANY MAGIC COMMENT HERE.

               # File irb/src_encoding.rb, line 3
def default_src_encoding
  return __ENCODING__
xmp(exps, bind = nil)

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:

require 'irb/xmp'
ctx = binding
xmp 'foo = "bar"', ctx
#=> foo = "bar"
ctx.eval 'foo'
#=> "bar"

See for more information.

               # File irb/xmp.rb, line 165
def xmp(exps, bind = nil)
  bind = unless bind
  xmp =
  xmp.puts exps