Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
86 lines (58 sloc) 3.24 KB

-Build Status - -Code Climate -Coverage Status tested with Ruby 2.0.0..2.3.0 - see .travis.yml


This tool locates public or protected methods that can be made private. After you have instrumented the tests suite (see below), it watches the code as the tests are executed and identifies non-private methods that are only called privately. As the technique used is tracing, the execution is slowed down substantially (ex: 300%)



Add this to the top of spec_helper.rb:

require 'private_please'
at_exit { puts }

Optionally, you can exclude_dir the tests code, local gems, or any source dir that could touched when running the tests.

SPECS_DIR  = File.dirname(__FILE__)
require 'private_please'
PrivatePlease.exclude_dir SPECS_DIR                  # don't analyze the tests
PrivatePlease.exclude_dir '/dev/my_local_gem'        # specified via path: in Gemfile
PrivatePlease.exclude_dir '/Applications/'
at_exit { puts, '') }

Example of result :

265 examples, 0 failures, 2 pending

=                               Privatazable methods :                             =
    21  ApplicationController::MissingAvatars#must_remind_user_to_setup_avatar?
    75  ApplicationController#allow?
    15  HomeController#redirect_to_default_page_for_signed_in_users
     4  MentorProfilesController#after_create_success


Add this line to your application's Gemfile:

gem 'private_please'

And then execute:

$ bundle

Or install it yourself as:

$ gem install private_please


After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to


Bug reports and pull requests are welcome on GitHub at


The gem is available as open source under the terms of the MIT License.

Something went wrong with that request. Please try again.