Project

patter

0.0
The project is in a healthy, maintained state
Pattern generator
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 13.0
~> 3.8
~> 0.21

Runtime

~> 0.8.1
~> 0.6.1
~> 2.7
 Project Readme

patter

patter is a ruby gem that generates strings from patterns.

A pattern is a sequence of tags and modifiers that defines the format of the output. For more on patterns see the CLI help output below.

Installation

Install from rubygems.

gem install patter

CLI

Usage:
    patter [options] <pattern>
    patter --version

Generate strings from <pattern>.

Options:
    -n, --count N       Number of patterns to generate [default: 10]
    -v, --version       Show version

Tags:
    {A} adjective       {N} noun
    {S} symbol          {D} digit
    {C} character

Modifiers:
    s: plural           t: titlecase
    u: uppercase        l: lowercase
    a: AlTeRnAtE case
    <number>: repeat <number> times

Apply modifiers using a colon after the tag name.

Examples:
    Ten random uppercase letters: {C:10u}
    Three camelcase nouns:        {N:3t}
    Plural, titlecase noun:       {N:ts}
    Uppercase adjective:          {A:u}
    Five random digits:           {D:5}
    A username:                   {A}_{N}

API

require 'patter'

puts Patter::Pattern.new('{A}')

Unit tests

just test

Contributions

Open an issue or send a pull request.

Licence

GPLv3.