Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fancy-p

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fancy-p

  • 0.5.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

fancy-p

fancy-p is a Ruby gem that extends the Kernel module to dynamically define print methods with different characters. It allows you to create methods like p!, p1, p2, etc., which print a specified character 100 times before and after.

This exists simply because I found myself writing p '!' * 100 too often. I followed a similar pattern for p 1 * 100, p2 * 100, etc.

For unpermitted characters, you can use the fp method, which takes a string of any length and prints it with a specified special character or str.

You can also create your own print methods pf_factory method.

Installation

Add this line to your application's Gemfile:

gem 'fancy-p'

Usage

require 'fancy-p'

p! 'Hello, world!'
# => "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
# => "Hello, world!"
# => "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"

p1 'Hello, world!'
# => "1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"
# => "Hello, world!"
# => "1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"
require 'fancy-p'

fp "@", "Hello, world!"
# => "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
# => "Hello, world!"
# => "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"

fp "@", "Hello, world!", length: 14
# => "@@@@@@@@@@@@@@"
# => "Hello, world!"
# => "@@@@@@@@@@@@@@"
require 'fancy-p'

print_wat = fp_factory "WAT ", length: 10

print_wat['Hello, world!']
# => "WAT WAT WAT WAT WAT WAT WAT WAT WAT WAT "
# => "Hello, world!"
# => "WAT WAT WAT WAT WAT WAT WAT WAT WAT WAT "

print_wat['Some other string']
# => "WAT WAT WAT WAT WAT WAT WAT WAT WAT WAT "
# => "Some other string"
# => "WAT WAT WAT WAT WAT WAT WAT WAT WAT WAT "

FAQs

Package last updated on 06 Aug 2024

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc