Class: BasicObject

Defined in:
lib/pry/core_extensions.rb

Direct Known Subclasses

Object, Pry::LastException

Instance Method Summary collapse

Instance Method Details

#__binding__Binding

Return a binding object for the receiver.

The ‘self` of the binding is set to the current object, and it contains no local variables.

The default definee (yugui.jp/articles/846) is set such that new methods defined will be added to the singleton class of the BasicObject.

Returns:

  • (Binding)


112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/pry/core_extensions.rb', line 112

def __binding__
  # BasicObjects don't have respond_to?, so we just define the method
  # every time. As they also don't have `.freeze`, this call won't
  # fail as it can for normal Objects.
  (class << self; self; end).class_eval "    # Get a binding with 'self' set to self, and no locals.\n    #\n    # The default definee is determined by the context in which the\n    # definition is eval'd.\n    #\n    # Please don't call this method directly, see {__binding__}.\n    #\n    # @return [Binding]\n    def __pry__\n      ::Kernel.binding\n    end\n  EOF\n  self.__pry__\nend\n", __FILE__, __LINE__ + 1