Skip to content
emeraldionPublic

About

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

Resources

Stars

4 stars

Watchers

0 watching

Forks

Latest commit

 

History

21 Commits

Folders and files

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

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages