https://github.com/colorfulcompany/slothful-code-generator
ms単位のそこそこの精度のtime-basedでuniqueなIDを人間の扱いやすい桁数で生成する
https://github.com/colorfulcompany/slothful-code-generator
foundation id ruby rubygems
Last synced: 9 months ago
JSON representation
ms単位のそこそこの精度のtime-basedでuniqueなIDを人間の扱いやすい桁数で生成する
- Host: GitHub
- URL: https://github.com/colorfulcompany/slothful-code-generator
- Owner: colorfulcompany
- License: bsd-2-clause
- Created: 2021-02-07T11:35:48.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-07-25T04:50:15.000Z (almost 2 years ago)
- Last Synced: 2025-06-04T11:21:18.660Z (about 1 year ago)
- Topics: foundation, id, ruby, rubygems
- Language: Ruby
- Homepage:
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SlothfulCode
ある程度人間にとって扱いやすい長さ、複雑さで、類推しにくく、重複しないコードを生成、検証する
## Installation
Add this line to your application's Gemfile:
```ruby
gem 'slothful-code-generator'
```
And then execute:
$ bundle
Or install it yourself as:
$ gem install slothful-code-generator
## Usage
```ruby
require 'slothful_code'
```
### ganerate
```ruby
sc = SlothfulCode.new()
sc.generate(type_id: '1') # => '989JV7WDCN6Q-1'
```
### decode
```ruby
sc = SlothfulCode.new()
sc.decode() # => {:type_id=>'1', :time=>[1612769809, 113]}
```
### valid?
```ruby
sc = SlothfulCode.new()
sc.valid?() # => true / false
```