Skip to content

🍞 Converts a list of strings into a compact, readable representation with delimiters of choice

License

Notifications You must be signed in to change notification settings

emeraldion/bocadillo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status Gem Version

bocadillo

Converts a list of strings into a compact, readable representation with delimiters of choice

bocadillo 'alba,albero,albergo,alberto'
# => alb(a|er(go|o|to))

bocadillo 'aria:arianna' ':' '[' '+' ']'
# => aria[+nna]

What?

In Spanish, bocadillo means sandwich. The name hints at the strings being sliced and interleaved with bread, the delimiters. Bocadillo is the Ruby port of the PHP package Tramezzino.

Why?

Useful when you need to pass long lists of URL params

Ruby Gem

Add it to your Ruby project as a Ruby Gem:

gem install bocadillo

Then have it your way:

require 'bocadillo'

encoded = Bocadillo.encode(['alba', 'albero', 'albergo', 'alberto'])
# => encoded == 'alb(a|er(go|o|to))'

The bocadillo gem also installs a bocadillo command:

$ bocadillo 'alba,albero,albino'
alb(a|ero|ino)

License

Copyright (c) 2017, Claudio Procida

MIT

About

🍞 Converts a list of strings into a compact, readable representation with delimiters of choice

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages