Code Climate Build Status

pry-larry.rb

Larry is a plugin for Pry. He keeps track of elapsed wall-clock time and tells you how long code or a Pry command you ran took to complete.

Configuration

The .pryrc file in your home directory or in the current working directory can be used to change the defaults of Larry. Larry can work without any custom configuration, but you might find it useful to tweak the default configuration. The example uses an API from Pry that might not be released yet(Pry.configure) but the old way is still supported.

Pry.configure do |config|
  config.larry.auto_start = false             # default is true
  config.larry.benchmark_commands = true      # default is false
  config.larry.speak_if = ->(pry, walltime) { # default is to speak if walltime is > 0.0
    walltime > 0.5
  }
  config.larry.speaker = ->(pry, walltime) {  # default is to print "Benchmark: X.XXs"
    pry.pager.page sprintf("Elapsed time: %.2fs", walltime)
  }
end

Examples

1.

Help screenshot

2.

Benchmark screenshot

Install

Rubygems

gem install pry-larry

Gemfile

gem "pry-larry", "~> 0.7"

License

This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.

In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.