Sha256: dcb4d23cda27e9b3f2084a6aa5b9808ae8c295f0fe8a68018ad7ad0c5d970f88

Contents?: true

Size: 1.29 KB

Versions: 40

Compression:

Stored size: 1.29 KB

Contents

class Object
  # Start a Pry REPL.  This method only differs from Pry.start in that it
  # assumes that the target is `self`.  It also accepts and passses the same
  # exact options hash that Pry.start accepts. POSSIBLE DEPRICATION WARNING:
  # In the future the backwards compatibility with pry(binding) could be
  # removed so please properly use Object.pry or if you use pry(binding)
  # switch Pry.start(binding).

  # @param [Binding] the binding or options hash if no binding needed.
  # @param [Hash] the options hash.
  # @example First
  #   "dummy".pry
  # @example Second
  #    binding.pry
  # @example An example with options
  #   def my_method
  #     binding.pry :quiet => true
  #   end
  #   my_method()

  def pry(*args)
    if args.first.is_a?(Hash) || args.length == 0
      args.unshift(self)
    end
    
    Pry.start(*args)
  end

  # Return a binding object for the receiver.
  def __binding__
    if is_a?(Module)
      return class_eval "binding"
    end

    unless respond_to? :__binding_impl__
      begin
        instance_eval %{
          def __binding_impl__
            binding
          end
        }
      rescue TypeError
        self.class.class_eval %{
          def __binding_impl__
            binding
          end
        }
      end
    end

    __binding_impl__
  end
end

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
pry-0.9.9.6 lib/pry/core_extensions.rb
pry-0.9.9.6-i386-mswin32 lib/pry/core_extensions.rb
pry-0.9.9.6-i386-mingw32 lib/pry/core_extensions.rb
pry-0.9.9.6-java lib/pry/core_extensions.rb
pry-0.9.9.6pre2 lib/pry/core_extensions.rb
pry-0.9.9.6pre2-i386-mswin32 lib/pry/core_extensions.rb
pry-0.9.9.6pre2-i386-mingw32 lib/pry/core_extensions.rb
pry-0.9.9.6pre2-java lib/pry/core_extensions.rb
pry-0.9.9.6pre1 lib/pry/core_extensions.rb
pry-0.9.9.6pre1-i386-mswin32 lib/pry/core_extensions.rb
pry-0.9.9.6pre1-i386-mingw32 lib/pry/core_extensions.rb
pry-0.9.9.6pre1-java lib/pry/core_extensions.rb
pry-0.9.9.5-java lib/pry/core_extensions.rb
pry-0.9.9.5 lib/pry/core_extensions.rb
pry-0.9.9.5-i386-mingw32 lib/pry/core_extensions.rb
pry-0.9.9.5-i386-mswin32 lib/pry/core_extensions.rb
pry-0.9.9.4 lib/pry/core_extensions.rb
pry-0.9.9.4-i386-mswin32 lib/pry/core_extensions.rb
pry-0.9.9.4-i386-mingw32 lib/pry/core_extensions.rb
pry-0.9.9.4-java lib/pry/core_extensions.rb