Sha256: 471dfeb16fab39f61271d3bc21d18cb87a27c838b1450c694c4a009be6690bec

Contents?: true

Size: 525 Bytes

Versions: 1

Compression:

Stored size: 525 Bytes

Contents

require 'facets/functor'

module Kernel

  # Fluent notation for accessing private methods.
  # This is a meta-progrmmers tool, and not meant
  # for general use.
  #
  #   class X
  #     attr :a
  #     private :a
  #     def initialize
  #       @a = 1
  #     end
  #   end
  #
  #   x = X.new
  #   p x.pry.a  #=> 1
  #   p x.a      #=> Error
  #
  # TODO: Add support for blocks in Ruby 1.9
  #
  # CREDIT: trans

  def pry
    @__pry__ ||= Functor.new do |s, *a|
      instance_eval{ send(s, *a) }
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
facets-2.6.0 lib/more/facets/pry.rb