Sha256: d7b83646bf61085b0a55fa1cc31342896cf8458f9772dfb7e5ca0ace8def37a2

Contents?: true

Size: 733 Bytes

Versions: 4

Compression:

Stored size: 733 Bytes

Contents

class Pry

  # The default hooks - display messages when beginning and ending Pry sessions.
  DEFAULT_HOOKS = {
    
    :before_session => proc do |out, target|
      out.puts "Beginning Pry session for #{Pry.view_clip(target.eval('self'))}"

      # ensure we're actually in a method
      meth_name = target.eval('__method__')
      file = target.eval('__FILE__')
      if ![nil, :__binding__, :__binding_impl__].include?(meth_name) && file !~ /(\(.*\))|<.*>/
        Pry.run_command "whereami", :output => out, :show_output => true, :context => target, :commands => Pry::Commands
      end
    end,
    
    :after_session => proc { |out, target| out.puts "Ending Pry session for #{Pry.view_clip(target.eval('self'))}" }
  }
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
pry-0.6.8-java lib/pry/hooks.rb
pry-0.6.8-i386-mswin32 lib/pry/hooks.rb
pry-0.6.8 lib/pry/hooks.rb
pry-0.6.8-i386-mingw32 lib/pry/hooks.rb