Sha256: 9b71bd4ea04b9d9acfa1165824188bf3f7dca525d2e31ec8f7947b80fefe0d38

Contents?: true

Size: 797 Bytes

Versions: 4

Compression:

Stored size: 797 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 ![:__script__, nil, :__binding__,
      # :__binding_impl__].include?(meth_name) && file !~
      # /(\(.*\))|<.*>/
      if 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.7.5.2-java lib/pry/hooks.rb
pry-0.7.5.2-i386-mswin32 lib/pry/hooks.rb
pry-0.7.5.2-i386-mingw32 lib/pry/hooks.rb
pry-0.7.5.2 lib/pry/hooks.rb