ruby-ulid 0.1.6 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6e67f6449c010a7c85ff8050a081b21e824ed876d7695a4fa22beb25f2a62534
4
- data.tar.gz: f0b0607131f8b04dd57c587746cd992a9a01070cacb53857fca6efb7dd11fe45
3
+ metadata.gz: fd21fa1c7af3acea07d2f4e6e7842927f1b33367e26b84bc5eef9a65a64c5582
4
+ data.tar.gz: da03f786abbbffa4411a4eb8b4ea189aecb3a920fb37026f1ae7f66398c5661f
5
5
  SHA512:
6
- metadata.gz: 5c1e3540e8e4f75c92fbc8347d2898fe8f8f233830a878c67462f8f9c9f065c969a9df8dd93e11bd27baa7a5cb7c1cb1eaf2fdf1e7dba5f5833e6295cd9d083f
7
- data.tar.gz: cd70d28d9cba7270ddf61dcf46bba1c4a04328d828ba7ed32a39c68c01f460b36f9f85da74fdb1d1b742309fdffb29d118cc8bc238c1744b61dbdc3a32255475
6
+ metadata.gz: 41143d43ef0f41f7441d0f2570bd73cad4ac6e382ea531c5f8aa30fccd5a4ff99790a356c6563c577153857b56eca8545d1b561f66b1ccdb5baa2aa281f2b692
7
+ data.tar.gz: 8c3bca9d754e6003af6af000bcb0d63fddb779586f3022cb33771182efa41ee0939c8d0a781ede46807c5cbf106b3389fbbefb684122c3d5ba704a8921b9f9a5
data/README.md CHANGED
@@ -10,8 +10,9 @@ Also providing [ruby/rbs](https://github.com/ruby/rbs) signature files.
10
10
 
11
11
  ![ULIDlogo](https://raw.githubusercontent.com/kachick/ruby-ulid/main/logo.png)
12
12
 
13
- ![Build Status](https://github.com/kachick/ruby-ulid/actions/workflows/test_behaviors.yml/badge.svg?branch=main)
13
+ [![Build Status](https://github.com/kachick/ruby-ulid/actions/workflows/test_behaviors.yml/badge.svg?branch=main)](https://github.com/kachick/ruby-ulid/actions/workflows/test_behaviors.yml/?branch=main)
14
14
  [![Gem Version](https://badge.fury.io/rb/ruby-ulid.png)](http://badge.fury.io/rb/ruby-ulid)
15
+ [![Visual Studio Code](https://img.shields.io/badge/Visual%20Studio%20Code-0078d7.svg?style=for-the-badge&logo=visual-studio-code&logoColor=white)](https://github.dev/kachick/ruby-ulid)
15
16
 
16
17
  ## Universally Unique Lexicographically Sortable Identifier
17
18
 
@@ -37,7 +38,7 @@ Instead, herein is proposed ULID:
37
38
 
38
39
  ### Install
39
40
 
40
- Require Ruby 2.6 or later
41
+ Require Ruby 2.7 or later
41
42
 
42
43
  This command will install the latest version into your environment
43
44
 
@@ -49,7 +50,7 @@ Should be installed!
49
50
  Add this line to your application/library's `Gemfile` is needed in basic use-case
50
51
 
51
52
  ```ruby
52
- gem 'ruby-ulid', '>= 0.1.6', '< 0.2.0'
53
+ gem 'ruby-ulid', '~> 0.2.0'
53
54
  ```
54
55
 
55
56
  ### Generator and Parser
@@ -170,8 +171,7 @@ exclude_end = ULID.range(time1...time2) #=> The end of `Range[ULID]` will be the
170
171
 
171
172
  # Below patterns are acceptable
172
173
  pinpointing = ULID.range(time1..time1) #=> This will match only for all IDs in `time1`
173
- # until_the_end = ULID.range(..time1) #=> This will match only for all IDs upto `time1` (The `nil` starting `Range` can be used since Ruby 2.7)
174
- until_the_end = ULID.range(ULID.min.to_time..time1) #=> This is same as above for Ruby 2.6
174
+ until_the_end = ULID.range(..time1) #=> This will match only for all IDs upto `time1`
175
175
  until_the_ulid_limit = ULID.range(time1..) # This will match only for all IDs from `time1` to max value of the ULID limit
176
176
 
177
177
  # So you can use the generated range objects as below
@@ -401,7 +401,7 @@ So you can replace the code as below
401
401
  +ULID.generate.to_s
402
402
  ```
403
403
 
404
- NOTE: It had crucial issue for handling precision, in version before `1.3.0`, when you extract timestamps from old generated ULIDs, it might be not accurate value.
404
+ NOTE: In version before `1.3.0`, timestamps might not be correct value.
405
405
 
406
406
  1. [Sort order does not respect millisecond ordering](https://github.com/rafaelsales/ulid/issues/22)
407
407
  1. [Fixed in this PR](https://github.com/rafaelsales/ulid/pull/23)
@@ -425,11 +425,12 @@ Major methods can be replaced as below.
425
425
  +ULID.max(time).to_s
426
426
  ```
427
427
 
428
- NOTE: It is still having precision issue similar as `ulid gem` in the both generator and parser. I sent PRs.
428
+ NOTE: In version before `1.0.2`, timestamps might not be correct value.
429
429
 
430
430
  1. [Parsed time object has more than milliseconds](https://github.com/abachman/ulid-ruby/issues/3)
431
431
  1. [Fix to handle timestamp precision in parser](https://github.com/abachman/ulid-ruby/pull/5)
432
432
  1. [Fix to handle timestamp precision in generator](https://github.com/abachman/ulid-ruby/pull/4)
433
+ 1. [Released in 1.0.2](https://github.com/abachman/ulid-ruby/compare/v1.0.0...v1.0.2)
433
434
 
434
435
  ### Compare performance with them
435
436
 
data/lib/ulid/version.rb CHANGED
@@ -2,5 +2,5 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  class ULID
5
- VERSION = '0.1.6'
5
+ VERSION = '0.2.0'
6
6
  end
data/lib/ulid.rb CHANGED
@@ -208,11 +208,7 @@ class ULID
208
208
  def self.floor(time)
209
209
  raise ArgumentError, 'ULID.floor takes only `Time` instance' unless Time === time
210
210
 
211
- if RUBY_VERSION >= '2.7'
212
- time.floor(3)
213
- else
214
- Time.at(0, milliseconds_from_time(time), :millisecond)
215
- end
211
+ time.floor(3)
216
212
  end
217
213
 
218
214
  # @api private
@@ -406,13 +402,7 @@ class ULID
406
402
 
407
403
  # @return [Time]
408
404
  def to_time
409
- @time ||= begin
410
- if RUBY_VERSION >= '2.7'
411
- Time.at(0, @milliseconds, :millisecond, in: 'UTC').freeze
412
- else
413
- Time.at(0, @milliseconds, :millisecond).utc.freeze
414
- end
415
- end
405
+ @time ||= Time.at(0, @milliseconds, :millisecond, in: 'UTC').freeze
416
406
  end
417
407
 
418
408
  # @return [Array(Integer, Integer, Integer, Integer, Integer, Integer, Integer, Integer, Integer, Integer, Integer, Integer, Integer, Integer, Integer, Integer)]
data/sig/ulid.rbs CHANGED
@@ -185,8 +185,7 @@ class ULID < Object
185
185
  #
186
186
  # # Below patterns are acceptable
187
187
  # pinpointing = ULID.range(time1..time1) #=> This will match only for all IDs in `time1`
188
- # until_the_end = ULID.range(..time1) #=> This will match only for all IDs upto `time1` (The `nil` starting `Range` can be used since Ruby 2.7)
189
- # until_the_end = ULID.range(ULID.min.to_time..time1) #=> This is same as above for Ruby 2.6
188
+ # until_the_end = ULID.range(..time1) #=> This will match only for all IDs upto `time1`
190
189
  # until_the_ulid_limit = ULID.range(time1..) # This will match only for all IDs from `time1` to max value of the ULID limit
191
190
  #
192
191
  # # So you can use the generated range objects as below
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-ulid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kenichi Kamiya
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-07-05 00:00:00.000000000 Z
11
+ date: 2022-05-13 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |2
14
14
  The ULID(Universally Unique Lexicographically Sortable Identifier) has useful specs for applications (e.g. `Database key`), especially possess all `uniqueness`, `randomness`, `extractable timestamps` and `sortable` features.
@@ -37,7 +37,8 @@ metadata:
37
37
  homepage_uri: https://github.com/kachick/ruby-ulid
38
38
  source_code_uri: https://github.com/kachick/ruby-ulid
39
39
  bug_tracker_uri: https://github.com/kachick/ruby-ulid/issues
40
- post_install_message:
40
+ rubygems_mfa_required: 'true'
41
+ post_install_message:
41
42
  rdoc_options: []
42
43
  require_paths:
43
44
  - lib
@@ -45,15 +46,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
45
46
  requirements:
46
47
  - - ">="
47
48
  - !ruby/object:Gem::Version
48
- version: 2.6.0
49
+ version: 2.7.0
49
50
  required_rubygems_version: !ruby/object:Gem::Requirement
50
51
  requirements:
51
52
  - - ">="
52
53
  - !ruby/object:Gem::Version
53
54
  version: '0'
54
55
  requirements: []
55
- rubygems_version: 3.2.15
56
- signing_key:
56
+ rubygems_version: 3.3.7
57
+ signing_key:
57
58
  specification_version: 4
58
59
  summary: ULID manipulation library
59
60
  test_files: []