# Pry config Pry.config.theme = 'monokai' if ENV['TERM'] == 'emacs' Pry.config.color = false Pry.config.pager = false Pry.config.auto_indent = false end # Show ruby version/patch level in prompt prompt = "#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}" Pry.config.prompt = [ proc { |obj, nest_level, _| "#{prompt} (#{obj}):#{nest_level} > " }, proc { |obj, nest_level, _| "#{prompt} (#{obj}):#{nest_level} * " } ] if defined?(PryByebug) Pry.commands.alias_command 'c', 'continue' Pry.commands.alias_command 's', 'step' Pry.commands.alias_command 'n', 'next' Pry.commands.alias_command 'f', 'finish' end # Repeat last command with enter Pry::Commands.command /^$/, 'repeat last command' do _pry_.run_command Pry.history.to_a.last end # https://github.com/michaeldv/awesome_print/ # $ gem install awesome_print begin require 'awesome_print' AwesomePrint.defaults = { indent: -2 } AwesomePrint.pry! rescue LoadError end ## Benchmarking # Inspired by . def time(repetitions = 100, &block) require 'benchmark' Benchmark.bm { |b| b.report { repetitions.times(&block) } } end