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

content_spinning

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

content_spinning

  • 0.3.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Content Spinning

Gem Version Build Status

ContentSpinning is a ruby library made to spin some text. It manages nested spinning.

Example

"Hi {there|you}! I'm {efficient|productive}.".spin
# or
ContentSpinning.spin("Hi {there|you}! I'm {efficient|productive}.")

returns this array :

[
  "Hi there! I'm efficient.",
  "Hi there! I'm productive.",
  "Hi you! I'm efficient.",
  "Hi you! I'm productive."
]

Install

gem install content_spinning

Usage

All spins

Calculating the number of possibilities:

> ContentSpinning.new("Hi {there|you}! I'm {efficient|productive}.").count

4

Generating:

> ContentSpinning.new("Hi {there|you}! I'm {efficient|productive}.").spin

[
  "Hi there! I'm efficient.",
  "Hi there! I'm productive.",
  "Hi you! I'm efficient.",
  "Hi you! I'm productive."
]

Beware, spins being combinatory, generating all the spins could be quite long.

Partial spins

There is no guaranty of unicity among the results returned (this is random). If you ask for a limit greater than the number of possibilities, this returns all the possibilities.

> ContentSpinning.new("Hi {there|you}! I'm {efficient|productive}.").spin(limit: 2)

[
  "Hi there! I'm efficient.",
  "Hi you! I'm productive."
]

> ContentSpinning.new("Hi {there|you}! I'm {efficient|productive}.").spin(limit: 500)

[
  "Hi there! I'm efficient.",
  "Hi there! I'm productive.",
  "Hi you! I'm efficient.",
  "Hi you! I'm productive."
]

Todo

A few things to do :

  • Executable

FAQs

Package last updated on 29 Jan 2017

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