Search code examples
rubyrubygemsbundlerperl-packager

why lib/pp.rb requires lib/pp/room which does not exist


I am trying to create gem using bundler. This gem requires pp gem to make 'pretty print'. I have require 'pp' at the top of the source and after that I use pp where needed. However, a runtime error occurs.

D:/PRJ/git/smde/vendor/bundle/ruby/2.5.0/gems/pp-0.1.1/lib/pp.rb:1:in `require': cannot load such file -- pp/room (LoadError)

There is no room file in lib/pp directory in pp gem. Why?

What is more interestingly, pp gem works well when I start my gem scripts directly, i.e. "ruby myscript.rb". The lack of pp/lib/room is not essential.


Solution

  • The "pp" gem is not required for using pretty print. That gem is related to Campfire, which does have the concept of a room. See https://www.rubydoc.info/gems/pp/0.1.1/Pp

    Pretty print is available to you without requiring anything: notice if you run irb, you can immediately type

    pp "something"
    

    And it will print as you want.