Project

ketsuban

0.0
No commit activity in last 3 years
No release in over 3 years
Skip unlucky numbers for ActiveRecord surrogate key
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

~> 5.2.0
 Project Readme

https://badge.fury.io/rb/ketsuban.svg Build Status Coverage Status

ketsuban

Skip unlucky numbers for ActiveRecord surrogate key id.

Usage

Gemfile:

gem 'ketsuban'

Some Model:

class User < ApplicationRecord
  include Ketsuban
  unlucky_numbers [4, 5]  
end

5.times.map { User.create.id }
# => [1, 2, 3, 6, 7]

or

class User < ApplicationRecord
  include Ketsuban
  unlucky_numbers ->(next_id) { next_id.odd? }
end

5.times.map { User.create.id }
# => [2, 4, 6, 8, 10]

unlucky_numbers is aliased ketsuban

License

The gem is available as open source under the terms of the MIT License.