Socket
Book a DemoInstallSign in
Socket

betterp

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

betterp

0.1.10
bundlerRubygems
Version published
Maintainers
1
Created
Source

betterp

Overview

betterp emulates Ruby's default p with a few extra goodies.

The standard Kernel#p method is overwritten with a version that provides the following features:

  • All output is prefixed with the file and line number that made the call to p
  • The output prefix is colourised. The colour is selected using a hash of the file path and line number so the colours are stable between each run.

The original semantics of Kernel#p are still applied, i.e. it returns the value(s) passed to it and the result of #inspect on each argument is output to a separate line.

Installation

Add the gem to your Gemfile

gem 'betterp', '~> 0.1.6'

And rebuild your bundle:

$ bundle install

Or install standalone:

$ gem install betterp -v '0.1.6'

Usage

Call p from anywhere in your code just as you normally would:

require 'betterp'

p 'hello'

betterp

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/bobf/betterp

License

MIT License

FAQs

Package last updated on 23 Nov 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.