0.0
No commit activity in last 3 years
No release in over 3 years
Very simple class to ensure that filenames are unique. If you are generating files into directory or adding files to zip archive, you probably want to avoid filenames collistion, when one file can overwrite another one with the same name. If filename is duplicated returns modified filename incremented sequentially.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies
 Project Readme

FilenamesSet

Very simple class to ensure that filenames are unique. If you are generating files into directory or adding files to zip archive, you probably want to avoid filenames collistion, when one file can overwrite another one with the same name. If filename is duplicated returns modified filename incremented sequentially.

Install

gem "filenames_set"

Usage

filenames = FilenamesSet.new
result = filenames << "example.pdf"
result # => "example.pdf"
result = filenames << "example.pdf"
result # => "example-2.pdf"