Project

nameq

0.0
No release in over 3 years
Low commit activity in last 3 years
Create unique names via numeric suffixes
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

 Project Readme

NameQ Build Status Gem Version

For when you need to name things, but not worry about whether or not those names are already taken.

Originally developed for Simulmedia.

Installation

Add this line to your application's Gemfile:

# update with the version of your choice
gem 'nameq'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install nameq

Usage

Build a pool of regular text strings. Each time you take an item from the pool, the pool will take note.

pool = NameQ::TextPool.new(['Kevin', 'Lynne', 'You', 'You (1)'])

pool.take('Someone Else')
# => "Someone Else"

pool.take('Kevin')
# => "Kevin (1)"

pool.take('You')
# => "You (2)"

pool.take('Kevin')
# => "Kevin (2)"

pool.take('Someone Else')
# => "Someone Else (1)"

Or point to a directory. In addition to the take behavior mentioned in the TextPool, new entries in the specified directory will be considered on each pool operation.

pool = NameQ::Directory.new('/tmp/nameq')

pool.take('not-a-file')
# => 'not-a-file'

pool.take('Rakefile')
# => 'Rakefile (1)'

Either type of pool can be treated case-insensitively:

NameQ::Directory.new('/tmp/nameq', case_sensitive: false)

Problems?

Please submit an issue. We'll figure out how to get you up and running with NameQ as smoothly as possible.