class BasicObject - pry-0.10.1 Documentation

# class BasicObject

### Public Instance Methods

__binding__() click to toggle source

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.

@return [Binding]

    # 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.
          #
          # The default definee is determined by the context in which the
          # definition is eval'd.
          #
          # Please don't call this method directly, see {__binding__}.
          #
          # @return [Binding]
          def __pry__
            ::Kernel.binding
          end
    ", __FILE__, __LINE__ + 1
        self.__pry__
      end