From 04982d7f213ae3dcf876baa4beaf769cc7095193 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Thu, 9 Oct 2014 18:30:43 -0400 Subject: [PATCH] Add pryrc --- pryrc | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 pryrc diff --git a/pryrc b/pryrc new file mode 100644 index 00000000..a0d8548d --- /dev/null +++ b/pryrc @@ -0,0 +1,23 @@ +# Pry config + +Pry.config.theme = 'monokai' + +# 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} * " } +] + +# https://github.com/michaeldv/awesome_print/ +# $ gem install awesome_print +require 'awesome_print' +AwesomePrint.defaults = { indent: -2 } +AwesomePrint.pry! + +## Benchmarking +# Inspired by . +def time(repetitions = 100, &block) + require 'benchmark' + Benchmark.bm { |b| b.report { repetitions.times(&block) } } +end