ulid-rails 0.1.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/.env +1 -0
 - data/.github/workflows/lint.yml +15 -0
 - data/.github/workflows/test.yml +17 -0
 - data/.gitignore +1 -0
 - data/.standard.yml +1 -0
 - data/CHANGELOG.md +30 -0
 - data/Gemfile +4 -1
 - data/README.md +49 -21
 - data/Rakefile +1 -1
 - data/bin/run_tests +18 -0
 - data/docker-compose.yml +49 -0
 - data/gemfiles/5.2.gemfile +6 -0
 - data/gemfiles/6.0.gemfile +6 -0
 - data/gemfiles/6.1.gemfile +6 -0
 - data/lib/ulid/rails/errors.rb +5 -0
 - data/lib/ulid/rails/formatter.rb +2 -9
 - data/lib/ulid/rails/patch.rb +2 -2
 - data/lib/ulid/rails/type.rb +33 -10
 - data/lib/ulid/rails/validator.rb +12 -0
 - data/lib/ulid/rails/version.rb +1 -1
 - data/lib/ulid/rails.rb +20 -11
 - data/ulid-rails.gemspec +13 -12
 - metadata +44 -18
 - data/.travis.yml +0 -7
 - data/Gemfile.lock +0 -49
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: b4ae7aa650be9d57249be6d2a1a3bf77bf26fdb14493533137d7296f07772410
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 521af5d85b5b033b182678cd189ebbbbebf6e4571f2cfe076bcae4fa37800c6d
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 7feebaa207e82b83fb213380f14df767216afb69ab8ee91d4ffd68495776d9b8c7f1ee2550f92ac5f7292b5b5c1511dc4a714cfa0671b2a7fe3528a15fb567b8
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 886b465219c7fd77f57dad6c2c6c658149cfa22918ab7505863af86382beafbeb1d4616f02e1d13190fb14ab2044a95c8a9ca55bba6cbd87703c870e00c19284
         
     | 
| 
         @@ -0,0 +1,15 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ---
         
     | 
| 
      
 2 
     | 
    
         
            +
            name: Linting
         
     | 
| 
      
 3 
     | 
    
         
            +
            on: [push, pull_request]
         
     | 
| 
      
 4 
     | 
    
         
            +
            jobs:
         
     | 
| 
      
 5 
     | 
    
         
            +
              standardrb:
         
     | 
| 
      
 6 
     | 
    
         
            +
                env:
         
     | 
| 
      
 7 
     | 
    
         
            +
                  AR_VERSION: "5.2"
         
     | 
| 
      
 8 
     | 
    
         
            +
                runs-on: ubuntu-latest
         
     | 
| 
      
 9 
     | 
    
         
            +
                steps:
         
     | 
| 
      
 10 
     | 
    
         
            +
                  - uses: actions/checkout@v2
         
     | 
| 
      
 11 
     | 
    
         
            +
                  - uses: ruby/setup-ruby@v1
         
     | 
| 
      
 12 
     | 
    
         
            +
                    with:
         
     | 
| 
      
 13 
     | 
    
         
            +
                      ruby-version: 3.0
         
     | 
| 
      
 14 
     | 
    
         
            +
                      bundler-cache: true
         
     | 
| 
      
 15 
     | 
    
         
            +
                  - run: bundle exec standardrb
         
     | 
| 
         @@ -0,0 +1,17 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ---
         
     | 
| 
      
 2 
     | 
    
         
            +
            name: Tests
         
     | 
| 
      
 3 
     | 
    
         
            +
            on: [push, pull_request]
         
     | 
| 
      
 4 
     | 
    
         
            +
            jobs:
         
     | 
| 
      
 5 
     | 
    
         
            +
              tests:
         
     | 
| 
      
 6 
     | 
    
         
            +
                runs-on: ubuntu-latest
         
     | 
| 
      
 7 
     | 
    
         
            +
                strategy:
         
     | 
| 
      
 8 
     | 
    
         
            +
                  matrix: 
         
     | 
| 
      
 9 
     | 
    
         
            +
                    activerecord-version: ["5.2", "6.0", "6.1"]
         
     | 
| 
      
 10 
     | 
    
         
            +
                    ruby-version: ["2.6", "2.7", "3.0"]
         
     | 
| 
      
 11 
     | 
    
         
            +
                    exclude:
         
     | 
| 
      
 12 
     | 
    
         
            +
                      - activerecord-version: "5.2"
         
     | 
| 
      
 13 
     | 
    
         
            +
                        ruby-version: "3.0"
         
     | 
| 
      
 14 
     | 
    
         
            +
                steps:
         
     | 
| 
      
 15 
     | 
    
         
            +
                  - uses: actions/checkout@v2
         
     | 
| 
      
 16 
     | 
    
         
            +
                  - name: Test ActiveRecord ${{ matrix.activerecord-version }} and Ruby ${{ matrix.ruby-version }}
         
     | 
| 
      
 17 
     | 
    
         
            +
                    run: RUBY_VERSION=${{ matrix.ruby-version }} docker-compose run -e AR_VERSION=${{ matrix.activerecord-version }} test
         
     | 
    
        data/.gitignore
    CHANGED
    
    
    
        data/.standard.yml
    ADDED
    
    | 
         @@ -0,0 +1 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ruby_version: 2.3
         
     | 
    
        data/CHANGELOG.md
    ADDED
    
    | 
         @@ -0,0 +1,30 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # ulid-rails CHANGELOG
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            ## 0.5
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            - Ensure ULID order respects timestamp order to millisecond precision.
         
     | 
| 
      
 6 
     | 
    
         
            +
            - Validation of ULID format when setting value. A wrong format value will trigger a `ULID::Rails::ArgumentError`.
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
            ## 0.4
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
            - Support old ruby versions
         
     | 
| 
      
 11 
     | 
    
         
            +
            - Fix auto_generate #2
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            ## 0.3
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            - Support PostgresQL
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
            ## 0.2
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
            ### Breaking Changes
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
            - `primary_key` option's default has been changed to `false`. Now you need to specify `primary_key: true` for primary keys: `ulid :id, primary_key: true`
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
            ### New Features
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
            - Added `auto_generate` option
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
            ### Bug Fixes
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
            - Auto-generate was on for foreign keys
         
     | 
| 
      
 30 
     | 
    
         
            +
            - Encoded ULID was not 0-padded #1
         
     | 
    
        data/Gemfile
    CHANGED
    
    | 
         @@ -1,6 +1,9 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            source "https://rubygems.org"
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
     | 
    
         
            -
            git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
         
     | 
| 
      
 3 
     | 
    
         
            +
            git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
       5 
5 
     | 
    
         
             
            # Specify your gem's dependencies in ulid-rails.gemspec
         
     | 
| 
       6 
6 
     | 
    
         
             
            gemspec
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
            version = ENV["AR_VERSION"] || "6.0"
         
     | 
| 
      
 9 
     | 
    
         
            +
            eval_gemfile File.expand_path("../gemfiles/#{version}.gemfile", __FILE__)
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -22,58 +22,76 @@ Or install it yourself as: 
     | 
|
| 
       22 
22 
     | 
    
         | 
| 
       23 
23 
     | 
    
         
             
            ### Migrations
         
     | 
| 
       24 
24 
     | 
    
         | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
      
 25 
     | 
    
         
            +
            Specify `id: false` to `create_table` and add `id` column as 16-byte binary type.
         
     | 
| 
       26 
26 
     | 
    
         | 
| 
       27 
27 
     | 
    
         
             
            ```ruby
         
     | 
| 
       28 
28 
     | 
    
         
             
              def change
         
     | 
| 
       29 
29 
     | 
    
         
             
                create_table :users, id: false do |t|
         
     | 
| 
       30 
     | 
    
         
            -
                  t.binary :id, limit: 16, primary_key: true 
     | 
| 
      
 30 
     | 
    
         
            +
                  t.binary :id, limit: 16, primary_key: true
         
     | 
| 
       31 
31 
     | 
    
         
             
                  # ...
         
     | 
| 
       32 
32 
     | 
    
         
             
                end
         
     | 
| 
       33 
33 
     | 
    
         
             
              end
         
     | 
| 
       34 
34 
     | 
    
         
             
            ```
         
     | 
| 
       35 
35 
     | 
    
         | 
| 
       36 
     | 
    
         
            -
             
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
            ### Model Changes
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
            Just add the below lines to your models.
         
     | 
| 
       37 
40 
     | 
    
         | 
| 
       38 
41 
     | 
    
         
             
            ```ruby
         
     | 
| 
       39 
     | 
    
         
            -
             
     | 
| 
       40 
     | 
    
         
            -
             
     | 
| 
       41 
     | 
    
         
            -
             
     | 
| 
       42 
     | 
    
         
            -
             
     | 
| 
       43 
     | 
    
         
            -
              end
         
     | 
| 
      
 42 
     | 
    
         
            +
            class MyModel < ApplicationRecord
         
     | 
| 
      
 43 
     | 
    
         
            +
              include ULID::Rails
         
     | 
| 
      
 44 
     | 
    
         
            +
              ulid :id, primary_key: true # The first argument is the ULID column name
         
     | 
| 
      
 45 
     | 
    
         
            +
            end
         
     | 
| 
       44 
46 
     | 
    
         
             
            ```
         
     | 
| 
       45 
47 
     | 
    
         | 
| 
      
 48 
     | 
    
         
            +
            ### Extract timestamp
         
     | 
| 
       46 
49 
     | 
    
         | 
| 
       47 
     | 
    
         
            -
             
     | 
| 
       48 
     | 
    
         
            -
             
     | 
| 
       49 
     | 
    
         
            -
            Just add the below lines to your models.
         
     | 
| 
      
 50 
     | 
    
         
            +
            Since ULID includes milli seconds precision timestamp, you don't need to store `created_at`.
         
     | 
| 
      
 51 
     | 
    
         
            +
            `ulid-rails` provides a helper method that defines timestamp method which extract timestamp from ULID column.
         
     | 
| 
       50 
52 
     | 
    
         | 
| 
       51 
53 
     | 
    
         
             
            ```ruby
         
     | 
| 
       52 
54 
     | 
    
         
             
            class MyModel < ApplicationRecord
         
     | 
| 
       53 
55 
     | 
    
         
             
              include ULID::Rails
         
     | 
| 
       54 
     | 
    
         
            -
              ulid :id # The argument is the  
     | 
| 
      
 56 
     | 
    
         
            +
              ulid :id, primary_key: true # The first argument is the ULID column name
         
     | 
| 
      
 57 
     | 
    
         
            +
             
     | 
| 
      
 58 
     | 
    
         
            +
              # defines `created_at` method which extract timestamp value from id column.
         
     | 
| 
      
 59 
     | 
    
         
            +
              # This way you don't need physical `created_at` column.
         
     | 
| 
      
 60 
     | 
    
         
            +
              ulid_extract_timestamp :id, :created_at
         
     | 
| 
       55 
61 
     | 
    
         
             
            end
         
     | 
| 
       56 
62 
     | 
    
         
             
            ```
         
     | 
| 
       57 
63 
     | 
    
         | 
| 
       58 
64 
     | 
    
         
             
            ### `created_at` virtual column
         
     | 
| 
       59 
65 
     | 
    
         | 
| 
       60 
     | 
    
         
            -
            **MySQL Only (for now)**
         
     | 
| 
       61 
     | 
    
         
            -
             
     | 
| 
       62 
     | 
    
         
            -
            Since ULID includes milli seconds precision timestamp, you don't need to store `created_at`. You can instead create a virtual column that extracts the timestamp from the ULID column.
         
     | 
| 
      
 66 
     | 
    
         
            +
            **MySQL 5.7 and higher Only (for now)**
         
     | 
| 
       63 
67 
     | 
    
         | 
| 
      
 68 
     | 
    
         
            +
            You can define a "virtual column" in MySQL DB that acts same as a physical column.
         
     | 
| 
       64 
69 
     | 
    
         
             
            Defining the virtual `created_at` is kind of comlicated so this gem provides a helper method for it.
         
     | 
| 
       65 
70 
     | 
    
         | 
| 
      
 71 
     | 
    
         
            +
            A virtual column is useful if you want to add index on the timestamp column or want to execute raw SQL with created_at.
         
     | 
| 
      
 72 
     | 
    
         
            +
             
     | 
| 
       66 
73 
     | 
    
         
             
            ```ruby
         
     | 
| 
       67 
     | 
    
         
            -
             
     | 
| 
       68 
     | 
    
         
            -
             
     | 
| 
       69 
     | 
    
         
            -
             
     | 
| 
       70 
     | 
    
         
            -
             
     | 
| 
       71 
     | 
    
         
            -
             
     | 
| 
      
 74 
     | 
    
         
            +
            create_table :users, id: false do |t|
         
     | 
| 
      
 75 
     | 
    
         
            +
              t.binary :id, limit: 16, primary_key: true
         
     | 
| 
      
 76 
     | 
    
         
            +
              t.datetime :updated_at
         
     | 
| 
      
 77 
     | 
    
         
            +
              t.virtual_ulid_timestamp :created_at, :id
         
     | 
| 
      
 78 
     | 
    
         
            +
            end
         
     | 
| 
       72 
79 
     | 
    
         
             
            ```
         
     | 
| 
       73 
80 
     | 
    
         | 
| 
       74 
81 
     | 
    
         
             
            `virtual_ulid_timestamp` takes two arguments, the first one is the name of the column name (typically, `created_at`) and the second one is the ULID column that creation timestamp is extracted from.
         
     | 
| 
       75 
82 
     | 
    
         | 
| 
       76 
     | 
    
         
            -
             
     | 
| 
      
 83 
     | 
    
         
            +
            ### Auto-generate ULID
         
     | 
| 
      
 84 
     | 
    
         
            +
             
     | 
| 
      
 85 
     | 
    
         
            +
            If `primary_key` is `true`, ULID is auto-generated before create by default.
         
     | 
| 
      
 86 
     | 
    
         
            +
            You can enable or disable auto-generation with `auto_generate` option.
         
     | 
| 
      
 87 
     | 
    
         
            +
             
     | 
| 
      
 88 
     | 
    
         
            +
            ```
         
     | 
| 
      
 89 
     | 
    
         
            +
            class Model < ApplicationRecord
         
     | 
| 
      
 90 
     | 
    
         
            +
              ulid :id, primary_key: true # primary key. auto-generate enabled
         
     | 
| 
      
 91 
     | 
    
         
            +
              ulid :foreign_key # auto-generate disabled
         
     | 
| 
      
 92 
     | 
    
         
            +
              ulid :ulid, auto_generate: true # non primary, auto-generate enabled
         
     | 
| 
      
 93 
     | 
    
         
            +
            end
         
     | 
| 
      
 94 
     | 
    
         
            +
            ```
         
     | 
| 
       77 
95 
     | 
    
         | 
| 
       78 
96 
     | 
    
         
             
            ### Foreign Keys
         
     | 
| 
       79 
97 
     | 
    
         | 
| 
         @@ -86,6 +104,16 @@ You need to specicfy `type` option 
     | 
|
| 
       86 
104 
     | 
    
         
             
                end
         
     | 
| 
       87 
105 
     | 
    
         
             
            ```
         
     | 
| 
       88 
106 
     | 
    
         | 
| 
      
 107 
     | 
    
         
            +
            ## Development
         
     | 
| 
      
 108 
     | 
    
         
            +
             
     | 
| 
      
 109 
     | 
    
         
            +
            ### Run tests
         
     | 
| 
      
 110 
     | 
    
         
            +
             
     | 
| 
      
 111 
     | 
    
         
            +
            Just run the below command to test with all supported DB engines.
         
     | 
| 
      
 112 
     | 
    
         
            +
             
     | 
| 
      
 113 
     | 
    
         
            +
            ```
         
     | 
| 
      
 114 
     | 
    
         
            +
            $ docker-compose run test
         
     | 
| 
      
 115 
     | 
    
         
            +
            ```
         
     | 
| 
      
 116 
     | 
    
         
            +
             
     | 
| 
       89 
117 
     | 
    
         
             
            ## License
         
     | 
| 
       90 
118 
     | 
    
         | 
| 
       91 
119 
     | 
    
         
             
            The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
         
     | 
    
        data/Rakefile
    CHANGED
    
    
    
        data/bin/run_tests
    ADDED
    
    
    
        data/docker-compose.yml
    ADDED
    
    | 
         @@ -0,0 +1,49 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            version: '3.6'
         
     | 
| 
      
 2 
     | 
    
         
            +
            services:
         
     | 
| 
      
 3 
     | 
    
         
            +
              test:
         
     | 
| 
      
 4 
     | 
    
         
            +
                image: "ruby:${RUBY_VERSION}" 
         
     | 
| 
      
 5 
     | 
    
         
            +
                command: sh -c "rm -f Gemfile.lock && bundle install && bin/run_tests"
         
     | 
| 
      
 6 
     | 
    
         
            +
                depends_on:
         
     | 
| 
      
 7 
     | 
    
         
            +
                  pg12:
         
     | 
| 
      
 8 
     | 
    
         
            +
                    condition: service_healthy
         
     | 
| 
      
 9 
     | 
    
         
            +
                  mysql56:
         
     | 
| 
      
 10 
     | 
    
         
            +
                    condition: service_healthy
         
     | 
| 
      
 11 
     | 
    
         
            +
                  mysql57:
         
     | 
| 
      
 12 
     | 
    
         
            +
                    condition: service_healthy
         
     | 
| 
      
 13 
     | 
    
         
            +
                  mysql80:
         
     | 
| 
      
 14 
     | 
    
         
            +
                    condition: service_healthy
         
     | 
| 
      
 15 
     | 
    
         
            +
                working_dir: /app
         
     | 
| 
      
 16 
     | 
    
         
            +
                volumes:
         
     | 
| 
      
 17 
     | 
    
         
            +
                  - bundle:/usr/local/bundle
         
     | 
| 
      
 18 
     | 
    
         
            +
                  - .:/app
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
              mysql56:
         
     | 
| 
      
 21 
     | 
    
         
            +
                image: mysql:5.6
         
     | 
| 
      
 22 
     | 
    
         
            +
                environment:
         
     | 
| 
      
 23 
     | 
    
         
            +
                  MYSQL_ROOT_PASSWORD: password
         
     | 
| 
      
 24 
     | 
    
         
            +
                command: --innodb-large-prefix --innodb-file-format=barracuda
         
     | 
| 
      
 25 
     | 
    
         
            +
                healthcheck:
         
     | 
| 
      
 26 
     | 
    
         
            +
                  test:  mysql --password=password -e "show databases;"
         
     | 
| 
      
 27 
     | 
    
         
            +
              mysql57:
         
     | 
| 
      
 28 
     | 
    
         
            +
                image: mysql:5.7
         
     | 
| 
      
 29 
     | 
    
         
            +
                environment:
         
     | 
| 
      
 30 
     | 
    
         
            +
                  MYSQL_ROOT_PASSWORD: password
         
     | 
| 
      
 31 
     | 
    
         
            +
                healthcheck:
         
     | 
| 
      
 32 
     | 
    
         
            +
                  test:  mysql --password=password -e "show databases;"
         
     | 
| 
      
 33 
     | 
    
         
            +
              mysql80:
         
     | 
| 
      
 34 
     | 
    
         
            +
                image: mysql:8.0
         
     | 
| 
      
 35 
     | 
    
         
            +
                command: --default-authentication-plugin=mysql_native_password
         
     | 
| 
      
 36 
     | 
    
         
            +
                environment:
         
     | 
| 
      
 37 
     | 
    
         
            +
                  MYSQL_ROOT_PASSWORD: password
         
     | 
| 
      
 38 
     | 
    
         
            +
                healthcheck:
         
     | 
| 
      
 39 
     | 
    
         
            +
                  test:  mysql --password=password -e "show databases;"
         
     | 
| 
      
 40 
     | 
    
         
            +
              pg12:
         
     | 
| 
      
 41 
     | 
    
         
            +
                image: postgres:12
         
     | 
| 
      
 42 
     | 
    
         
            +
                environment:
         
     | 
| 
      
 43 
     | 
    
         
            +
                  PGDATA: /data
         
     | 
| 
      
 44 
     | 
    
         
            +
                  POSTGRES_DB: db
         
     | 
| 
      
 45 
     | 
    
         
            +
                  POSTGRES_HOST_AUTH_METHOD: trust
         
     | 
| 
      
 46 
     | 
    
         
            +
                healthcheck:
         
     | 
| 
      
 47 
     | 
    
         
            +
                  test: echo "\\l" | psql -U postgres
         
     | 
| 
      
 48 
     | 
    
         
            +
            volumes:
         
     | 
| 
      
 49 
     | 
    
         
            +
              bundle:
         
     | 
    
        data/lib/ulid/rails/formatter.rb
    CHANGED
    
    | 
         @@ -4,20 +4,13 @@ module ULID 
     | 
|
| 
       4 
4 
     | 
    
         
             
              module Rails
         
     | 
| 
       5 
5 
     | 
    
         
             
                module Formatter
         
     | 
| 
       6 
6 
     | 
    
         
             
                  def self.format(v)
         
     | 
| 
       7 
     | 
    
         
            -
                     
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
       9 
     | 
    
         
            -
                    else
         
     | 
| 
       10 
     | 
    
         
            -
                      v
         
     | 
| 
       11 
     | 
    
         
            -
                    end
         
     | 
| 
      
 7 
     | 
    
         
            +
                    sanitized = v.delete("-").hex
         
     | 
| 
      
 8 
     | 
    
         
            +
                    Base32::Crockford.encode(sanitized).rjust(26, "0")
         
     | 
| 
       12 
9 
     | 
    
         
             
                  end
         
     | 
| 
       13 
10 
     | 
    
         | 
| 
       14 
11 
     | 
    
         
             
                  def self.unformat(v)
         
     | 
| 
       15 
12 
     | 
    
         
             
                    Base32::Crockford.decode(v).to_s(16).rjust(32, "0")
         
     | 
| 
       16 
13 
     | 
    
         
             
                  end
         
     | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
       18 
     | 
    
         
            -
                  def self.regexp
         
     | 
| 
       19 
     | 
    
         
            -
                    /\A[[:alnum:]]{25}\z/
         
     | 
| 
       20 
     | 
    
         
            -
                  end
         
     | 
| 
       21 
14 
     | 
    
         
             
                end
         
     | 
| 
       22 
15 
     | 
    
         
             
              end
         
     | 
| 
       23 
16 
     | 
    
         
             
            end
         
     | 
    
        data/lib/ulid/rails/patch.rb
    CHANGED
    
    | 
         @@ -4,8 +4,8 @@ module ULID 
     | 
|
| 
       4 
4 
     | 
    
         
             
                  module Migrations
         
     | 
| 
       5 
5 
     | 
    
         
             
                    def virtual_ulid_timestamp(timestamp_column_name, ulid_column_name)
         
     | 
| 
       6 
6 
     | 
    
         
             
                      virtual timestamp_column_name,
         
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
      
 7 
     | 
    
         
            +
                        type: :datetime,
         
     | 
| 
      
 8 
     | 
    
         
            +
                        as: "FROM_UNIXTIME(CONV(HEX(#{ulid_column_name} >> 80), 16, 10) / 1000.0)"
         
     | 
| 
       9 
9 
     | 
    
         
             
                    end
         
     | 
| 
       10 
10 
     | 
    
         
             
                  end
         
     | 
| 
       11 
11 
     | 
    
         
             
                end
         
     | 
    
        data/lib/ulid/rails/type.rb
    CHANGED
    
    | 
         @@ -1,5 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require "active_model/type"
         
     | 
| 
       2 
2 
     | 
    
         
             
            require "ulid/rails/formatter"
         
     | 
| 
      
 3 
     | 
    
         
            +
            require "ulid/rails/validator"
         
     | 
| 
      
 4 
     | 
    
         
            +
            require "ulid/rails/errors"
         
     | 
| 
       3 
5 
     | 
    
         | 
| 
       4 
6 
     | 
    
         
             
            module ULID
         
     | 
| 
       5 
7 
     | 
    
         
             
              module Rails
         
     | 
| 
         @@ -8,24 +10,45 @@ module ULID 
     | 
|
| 
       8 
10 
     | 
    
         
             
                    alias_method :hex, :to_s
         
     | 
| 
       9 
11 
     | 
    
         
             
                  end
         
     | 
| 
       10 
12 
     | 
    
         | 
| 
       11 
     | 
    
         
            -
                  def initialize(formatter = Formatter)
         
     | 
| 
      
 13 
     | 
    
         
            +
                  def initialize(formatter = Formatter, validator = Validator)
         
     | 
| 
       12 
14 
     | 
    
         
             
                    @formatter = formatter
         
     | 
| 
      
 15 
     | 
    
         
            +
                    @validator = validator
         
     | 
| 
       13 
16 
     | 
    
         
             
                    super()
         
     | 
| 
       14 
17 
     | 
    
         
             
                  end
         
     | 
| 
       15 
18 
     | 
    
         | 
| 
       16 
     | 
    
         
            -
                  def  
     | 
| 
       17 
     | 
    
         
            -
                     
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
                     
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
                     
     | 
| 
      
 19 
     | 
    
         
            +
                  def assert_valid_value(value)
         
     | 
| 
      
 20 
     | 
    
         
            +
                    raise ArgumentError, "`#{value}` is not a ULID format" unless @validator.is_valid?(value)
         
     | 
| 
      
 21 
     | 
    
         
            +
                  end
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
                  def deserialize(value)
         
     | 
| 
      
 24 
     | 
    
         
            +
                    return nil if value.nil?
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
                    value = value.to_s if value.is_a?(Data)
         
     | 
| 
      
 27 
     | 
    
         
            +
                    value = value.unpack1("H*") if value.encoding == Encoding::ASCII_8BIT
         
     | 
| 
      
 28 
     | 
    
         
            +
                    value = value[2..-1] if value.start_with?("\\x")
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
                    value.length == 32 ? @formatter.format(value) : super
         
     | 
| 
       24 
31 
     | 
    
         
             
                  end
         
     | 
| 
       25 
32 
     | 
    
         | 
| 
       26 
33 
     | 
    
         
             
                  def serialize(value)
         
     | 
| 
       27 
34 
     | 
    
         
             
                    return if value.nil?
         
     | 
| 
       28 
     | 
    
         
            -
             
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
                    case adapter
         
     | 
| 
      
 37 
     | 
    
         
            +
                    when "mysql2", "sqlite3"
         
     | 
| 
      
 38 
     | 
    
         
            +
                      Data.new(@formatter.unformat(value))
         
     | 
| 
      
 39 
     | 
    
         
            +
                    when "postgresql"
         
     | 
| 
      
 40 
     | 
    
         
            +
                      Data.new([@formatter.unformat(value)].pack("H*"))
         
     | 
| 
      
 41 
     | 
    
         
            +
                    end
         
     | 
| 
      
 42 
     | 
    
         
            +
                  end
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
                  private
         
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
      
 46 
     | 
    
         
            +
                  def adapter
         
     | 
| 
      
 47 
     | 
    
         
            +
                    if ::ActiveRecord::Base.respond_to?(:connection_db_config)
         
     | 
| 
      
 48 
     | 
    
         
            +
                      ::ActiveRecord::Base.connection_db_config.configuration_hash[:adapter]
         
     | 
| 
      
 49 
     | 
    
         
            +
                    else
         
     | 
| 
      
 50 
     | 
    
         
            +
                      ::ActiveRecord::Base.connection_config[:adapter]
         
     | 
| 
      
 51 
     | 
    
         
            +
                    end
         
     | 
| 
       29 
52 
     | 
    
         
             
                  end
         
     | 
| 
       30 
53 
     | 
    
         
             
                end
         
     | 
| 
       31 
54 
     | 
    
         
             
              end
         
     | 
    
        data/lib/ulid/rails/version.rb
    CHANGED
    
    
    
        data/lib/ulid/rails.rb
    CHANGED
    
    | 
         @@ -12,23 +12,32 @@ module ULID 
     | 
|
| 
       12 
12 
     | 
    
         
             
                extend ActiveSupport::Concern
         
     | 
| 
       13 
13 
     | 
    
         | 
| 
       14 
14 
     | 
    
         
             
                class_methods do
         
     | 
| 
       15 
     | 
    
         
            -
                  def ulid(column_name  
     | 
| 
      
 15 
     | 
    
         
            +
                  def ulid(column_name, primary_key: false, auto_generate: nil)
         
     | 
| 
       16 
16 
     | 
    
         
             
                    attribute column_name, ULID::Rails::Type.new
         
     | 
| 
       17 
17 
     | 
    
         | 
| 
       18 
     | 
    
         
            -
                     
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
      
 18 
     | 
    
         
            +
                    auto_generate = primary_key || auto_generate
         
     | 
| 
      
 19 
     | 
    
         
            +
                    if auto_generate
         
     | 
| 
      
 20 
     | 
    
         
            +
                      before_create do
         
     | 
| 
      
 21 
     | 
    
         
            +
                        send("#{column_name}=", ULID.generate) if send(column_name).nil?
         
     | 
| 
      
 22 
     | 
    
         
            +
                      end
         
     | 
| 
       20 
23 
     | 
    
         
             
                    end
         
     | 
| 
      
 24 
     | 
    
         
            +
                  end
         
     | 
| 
       21 
25 
     | 
    
         | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
       25 
     | 
    
         
            -
                         
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
                         
     | 
| 
       28 
     | 
    
         
            -
                          at
         
     | 
| 
       29 
     | 
    
         
            -
                        end
         
     | 
| 
      
 26 
     | 
    
         
            +
                  def ulid_extract_timestamp(ulid_column, timestamp_column = :created_at)
         
     | 
| 
      
 27 
     | 
    
         
            +
                    define_method timestamp_column do
         
     | 
| 
      
 28 
     | 
    
         
            +
                      at = begin
         
     | 
| 
      
 29 
     | 
    
         
            +
                        super()
         
     | 
| 
      
 30 
     | 
    
         
            +
                      rescue
         
     | 
| 
      
 31 
     | 
    
         
            +
                        nil
         
     | 
| 
       30 
32 
     | 
    
         
             
                      end
         
     | 
| 
      
 33 
     | 
    
         
            +
                      if !at && (id_val = send(ulid_column))
         
     | 
| 
      
 34 
     | 
    
         
            +
                        Time.zone.at((Base32::Crockford.decode(id_val) >> 80) / 1000.0)
         
     | 
| 
      
 35 
     | 
    
         
            +
                      else
         
     | 
| 
      
 36 
     | 
    
         
            +
                        at
         
     | 
| 
      
 37 
     | 
    
         
            +
                      end
         
     | 
| 
      
 38 
     | 
    
         
            +
                    end
         
     | 
| 
       31 
39 
     | 
    
         | 
| 
      
 40 
     | 
    
         
            +
                    if timestamp_column.to_s == "created_at"
         
     | 
| 
       32 
41 
     | 
    
         
             
                      define_singleton_method(:timestamp_attributes_for_create) do
         
     | 
| 
       33 
42 
     | 
    
         
             
                        []
         
     | 
| 
       34 
43 
     | 
    
         
             
                      end
         
     | 
    
        data/ulid-rails.gemspec
    CHANGED
    
    | 
         @@ -3,22 +3,22 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) 
     | 
|
| 
       3 
3 
     | 
    
         
             
            require "ulid/rails/version"
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
       5 
5 
     | 
    
         
             
            Gem::Specification.new do |spec|
         
     | 
| 
       6 
     | 
    
         
            -
              spec.name 
     | 
| 
       7 
     | 
    
         
            -
              spec.version 
     | 
| 
       8 
     | 
    
         
            -
              spec.authors 
     | 
| 
       9 
     | 
    
         
            -
              spec.email 
     | 
| 
      
 6 
     | 
    
         
            +
              spec.name = "ulid-rails"
         
     | 
| 
      
 7 
     | 
    
         
            +
              spec.version = ULID::Rails::VERSION
         
     | 
| 
      
 8 
     | 
    
         
            +
              spec.authors = ["Kazunori Kajihiro", "Zendesk"]
         
     | 
| 
      
 9 
     | 
    
         
            +
              spec.email = ["kazunori.kajihiro@gmail.com", "ruby-core@zendesk.com"]
         
     | 
| 
       10 
10 
     | 
    
         | 
| 
       11 
     | 
    
         
            -
              spec.summary 
     | 
| 
       12 
     | 
    
         
            -
              spec.description 
     | 
| 
       13 
     | 
    
         
            -
              spec.license 
     | 
| 
      
 11 
     | 
    
         
            +
              spec.summary = "ULID for rails"
         
     | 
| 
      
 12 
     | 
    
         
            +
              spec.description = "ULID for rails"
         
     | 
| 
      
 13 
     | 
    
         
            +
              spec.license = "MIT"
         
     | 
| 
       14 
14 
     | 
    
         | 
| 
       15 
15 
     | 
    
         
             
              # Specify which files should be added to the gem when it is released.
         
     | 
| 
       16 
16 
     | 
    
         
             
              # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
         
     | 
| 
       17 
     | 
    
         
            -
              spec.files 
     | 
| 
      
 17 
     | 
    
         
            +
              spec.files = Dir.chdir(File.expand_path("..", __FILE__)) do
         
     | 
| 
       18 
18 
     | 
    
         
             
                `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
         
     | 
| 
       19 
19 
     | 
    
         
             
              end
         
     | 
| 
       20 
     | 
    
         
            -
              spec.bindir 
     | 
| 
       21 
     | 
    
         
            -
              spec.executables 
     | 
| 
      
 20 
     | 
    
         
            +
              spec.bindir = "exe"
         
     | 
| 
      
 21 
     | 
    
         
            +
              spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
         
     | 
| 
       22 
22 
     | 
    
         
             
              spec.require_paths = ["lib"]
         
     | 
| 
       23 
23 
     | 
    
         | 
| 
       24 
24 
     | 
    
         
             
              spec.add_dependency "ulid", "~> 1.0"
         
     | 
| 
         @@ -26,7 +26,8 @@ Gem::Specification.new do |spec| 
     | 
|
| 
       26 
26 
     | 
    
         
             
              spec.add_dependency "activesupport", ">= 5.0"
         
     | 
| 
       27 
27 
     | 
    
         
             
              spec.add_dependency "activemodel", ">= 5.0"
         
     | 
| 
       28 
28 
     | 
    
         
             
              spec.add_dependency "activerecord", ">= 5.0"
         
     | 
| 
       29 
     | 
    
         
            -
              spec.add_development_dependency "bundler" 
     | 
| 
       30 
     | 
    
         
            -
              spec.add_development_dependency "rake" 
     | 
| 
      
 29 
     | 
    
         
            +
              spec.add_development_dependency "bundler"
         
     | 
| 
      
 30 
     | 
    
         
            +
              spec.add_development_dependency "rake"
         
     | 
| 
       31 
31 
     | 
    
         
             
              spec.add_development_dependency "minitest", "~> 5.0"
         
     | 
| 
      
 32 
     | 
    
         
            +
              spec.add_development_dependency "standard", "~> 1.3.0"
         
     | 
| 
       32 
33 
     | 
    
         
             
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,15 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: ulid-rails
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.5.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Kazunori Kajihiro
         
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
      
 8 
     | 
    
         
            +
            - Zendesk
         
     | 
| 
      
 9 
     | 
    
         
            +
            autorequire:
         
     | 
| 
       9 
10 
     | 
    
         
             
            bindir: exe
         
     | 
| 
       10 
11 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date:  
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2021-10-25 00:00:00.000000000 Z
         
     | 
| 
       12 
13 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
14 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
15 
     | 
    
         
             
              name: ulid
         
     | 
| 
         @@ -84,30 +85,30 @@ dependencies: 
     | 
|
| 
       84 
85 
     | 
    
         
             
              name: bundler
         
     | 
| 
       85 
86 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       86 
87 
     | 
    
         
             
                requirements:
         
     | 
| 
       87 
     | 
    
         
            -
                - - " 
     | 
| 
      
 88 
     | 
    
         
            +
                - - ">="
         
     | 
| 
       88 
89 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       89 
     | 
    
         
            -
                    version: ' 
     | 
| 
      
 90 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
       90 
91 
     | 
    
         
             
              type: :development
         
     | 
| 
       91 
92 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       92 
93 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       93 
94 
     | 
    
         
             
                requirements:
         
     | 
| 
       94 
     | 
    
         
            -
                - - " 
     | 
| 
      
 95 
     | 
    
         
            +
                - - ">="
         
     | 
| 
       95 
96 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       96 
     | 
    
         
            -
                    version: ' 
     | 
| 
      
 97 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
       97 
98 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       98 
99 
     | 
    
         
             
              name: rake
         
     | 
| 
       99 
100 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       100 
101 
     | 
    
         
             
                requirements:
         
     | 
| 
       101 
     | 
    
         
            -
                - - " 
     | 
| 
      
 102 
     | 
    
         
            +
                - - ">="
         
     | 
| 
       102 
103 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       103 
     | 
    
         
            -
                    version: ' 
     | 
| 
      
 104 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
       104 
105 
     | 
    
         
             
              type: :development
         
     | 
| 
       105 
106 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       106 
107 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       107 
108 
     | 
    
         
             
                requirements:
         
     | 
| 
       108 
     | 
    
         
            -
                - - " 
     | 
| 
      
 109 
     | 
    
         
            +
                - - ">="
         
     | 
| 
       109 
110 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       110 
     | 
    
         
            -
                    version: ' 
     | 
| 
      
 111 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
       111 
112 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       112 
113 
     | 
    
         
             
              name: minitest
         
     | 
| 
       113 
114 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
         @@ -122,33 +123,58 @@ dependencies: 
     | 
|
| 
       122 
123 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       123 
124 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       124 
125 
     | 
    
         
             
                    version: '5.0'
         
     | 
| 
      
 126 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 127 
     | 
    
         
            +
              name: standard
         
     | 
| 
      
 128 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 129 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 130 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 131 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 132 
     | 
    
         
            +
                    version: 1.3.0
         
     | 
| 
      
 133 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 134 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 135 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 136 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 137 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 138 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 139 
     | 
    
         
            +
                    version: 1.3.0
         
     | 
| 
       125 
140 
     | 
    
         
             
            description: ULID for rails
         
     | 
| 
       126 
141 
     | 
    
         
             
            email:
         
     | 
| 
       127 
142 
     | 
    
         
             
            - kazunori.kajihiro@gmail.com
         
     | 
| 
      
 143 
     | 
    
         
            +
            - ruby-core@zendesk.com
         
     | 
| 
       128 
144 
     | 
    
         
             
            executables: []
         
     | 
| 
       129 
145 
     | 
    
         
             
            extensions: []
         
     | 
| 
       130 
146 
     | 
    
         
             
            extra_rdoc_files: []
         
     | 
| 
       131 
147 
     | 
    
         
             
            files:
         
     | 
| 
      
 148 
     | 
    
         
            +
            - ".env"
         
     | 
| 
      
 149 
     | 
    
         
            +
            - ".github/workflows/lint.yml"
         
     | 
| 
      
 150 
     | 
    
         
            +
            - ".github/workflows/test.yml"
         
     | 
| 
       132 
151 
     | 
    
         
             
            - ".gitignore"
         
     | 
| 
       133 
     | 
    
         
            -
            - ". 
     | 
| 
      
 152 
     | 
    
         
            +
            - ".standard.yml"
         
     | 
| 
      
 153 
     | 
    
         
            +
            - CHANGELOG.md
         
     | 
| 
       134 
154 
     | 
    
         
             
            - Gemfile
         
     | 
| 
       135 
     | 
    
         
            -
            - Gemfile.lock
         
     | 
| 
       136 
155 
     | 
    
         
             
            - LICENSE.txt
         
     | 
| 
       137 
156 
     | 
    
         
             
            - README.md
         
     | 
| 
       138 
157 
     | 
    
         
             
            - Rakefile
         
     | 
| 
       139 
158 
     | 
    
         
             
            - bin/console
         
     | 
| 
      
 159 
     | 
    
         
            +
            - bin/run_tests
         
     | 
| 
       140 
160 
     | 
    
         
             
            - bin/setup
         
     | 
| 
      
 161 
     | 
    
         
            +
            - docker-compose.yml
         
     | 
| 
      
 162 
     | 
    
         
            +
            - gemfiles/5.2.gemfile
         
     | 
| 
      
 163 
     | 
    
         
            +
            - gemfiles/6.0.gemfile
         
     | 
| 
      
 164 
     | 
    
         
            +
            - gemfiles/6.1.gemfile
         
     | 
| 
       141 
165 
     | 
    
         
             
            - lib/ulid/rails.rb
         
     | 
| 
      
 166 
     | 
    
         
            +
            - lib/ulid/rails/errors.rb
         
     | 
| 
       142 
167 
     | 
    
         
             
            - lib/ulid/rails/formatter.rb
         
     | 
| 
       143 
168 
     | 
    
         
             
            - lib/ulid/rails/patch.rb
         
     | 
| 
       144 
169 
     | 
    
         
             
            - lib/ulid/rails/type.rb
         
     | 
| 
      
 170 
     | 
    
         
            +
            - lib/ulid/rails/validator.rb
         
     | 
| 
       145 
171 
     | 
    
         
             
            - lib/ulid/rails/version.rb
         
     | 
| 
       146 
172 
     | 
    
         
             
            - ulid-rails.gemspec
         
     | 
| 
       147 
     | 
    
         
            -
            homepage: 
     | 
| 
      
 173 
     | 
    
         
            +
            homepage:
         
     | 
| 
       148 
174 
     | 
    
         
             
            licenses:
         
     | 
| 
       149 
175 
     | 
    
         
             
            - MIT
         
     | 
| 
       150 
176 
     | 
    
         
             
            metadata: {}
         
     | 
| 
       151 
     | 
    
         
            -
            post_install_message: 
     | 
| 
      
 177 
     | 
    
         
            +
            post_install_message:
         
     | 
| 
       152 
178 
     | 
    
         
             
            rdoc_options: []
         
     | 
| 
       153 
179 
     | 
    
         
             
            require_paths:
         
     | 
| 
       154 
180 
     | 
    
         
             
            - lib
         
     | 
| 
         @@ -163,9 +189,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       163 
189 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       164 
190 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       165 
191 
     | 
    
         
             
            requirements: []
         
     | 
| 
       166 
     | 
    
         
            -
            rubyforge_project: 
     | 
| 
       167 
     | 
    
         
            -
            rubygems_version: 2.7.6
         
     | 
| 
       168 
     | 
    
         
            -
            signing_key: 
     | 
| 
      
 192 
     | 
    
         
            +
            rubyforge_project:
         
     | 
| 
      
 193 
     | 
    
         
            +
            rubygems_version: 2.7.6.3
         
     | 
| 
      
 194 
     | 
    
         
            +
            signing_key:
         
     | 
| 
       169 
195 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       170 
196 
     | 
    
         
             
            summary: ULID for rails
         
     | 
| 
       171 
197 
     | 
    
         
             
            test_files: []
         
     | 
    
        data/.travis.yml
    DELETED
    
    
    
        data/Gemfile.lock
    DELETED
    
    | 
         @@ -1,49 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            PATH
         
     | 
| 
       2 
     | 
    
         
            -
              remote: .
         
     | 
| 
       3 
     | 
    
         
            -
              specs:
         
     | 
| 
       4 
     | 
    
         
            -
                ulid-rails (0.1.0)
         
     | 
| 
       5 
     | 
    
         
            -
                  activemodel (>= 5.0)
         
     | 
| 
       6 
     | 
    
         
            -
                  activerecord (>= 5.0)
         
     | 
| 
       7 
     | 
    
         
            -
                  activesupport (>= 5.0)
         
     | 
| 
       8 
     | 
    
         
            -
                  base32-crockford (~> 0.1)
         
     | 
| 
       9 
     | 
    
         
            -
                  ulid (~> 1.0)
         
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
            GEM
         
     | 
| 
       12 
     | 
    
         
            -
              remote: https://rubygems.org/
         
     | 
| 
       13 
     | 
    
         
            -
              specs:
         
     | 
| 
       14 
     | 
    
         
            -
                activemodel (5.2.1)
         
     | 
| 
       15 
     | 
    
         
            -
                  activesupport (= 5.2.1)
         
     | 
| 
       16 
     | 
    
         
            -
                activerecord (5.2.1)
         
     | 
| 
       17 
     | 
    
         
            -
                  activemodel (= 5.2.1)
         
     | 
| 
       18 
     | 
    
         
            -
                  activesupport (= 5.2.1)
         
     | 
| 
       19 
     | 
    
         
            -
                  arel (>= 9.0)
         
     | 
| 
       20 
     | 
    
         
            -
                activesupport (5.2.1)
         
     | 
| 
       21 
     | 
    
         
            -
                  concurrent-ruby (~> 1.0, >= 1.0.2)
         
     | 
| 
       22 
     | 
    
         
            -
                  i18n (>= 0.7, < 2)
         
     | 
| 
       23 
     | 
    
         
            -
                  minitest (~> 5.1)
         
     | 
| 
       24 
     | 
    
         
            -
                  tzinfo (~> 1.1)
         
     | 
| 
       25 
     | 
    
         
            -
                arel (9.0.0)
         
     | 
| 
       26 
     | 
    
         
            -
                base32-crockford (0.1.0)
         
     | 
| 
       27 
     | 
    
         
            -
                concurrent-ruby (1.0.5)
         
     | 
| 
       28 
     | 
    
         
            -
                i18n (1.1.0)
         
     | 
| 
       29 
     | 
    
         
            -
                  concurrent-ruby (~> 1.0)
         
     | 
| 
       30 
     | 
    
         
            -
                minitest (5.11.3)
         
     | 
| 
       31 
     | 
    
         
            -
                rake (10.5.0)
         
     | 
| 
       32 
     | 
    
         
            -
                sysrandom (1.0.5)
         
     | 
| 
       33 
     | 
    
         
            -
                thread_safe (0.3.6)
         
     | 
| 
       34 
     | 
    
         
            -
                tzinfo (1.2.5)
         
     | 
| 
       35 
     | 
    
         
            -
                  thread_safe (~> 0.1)
         
     | 
| 
       36 
     | 
    
         
            -
                ulid (1.0.0)
         
     | 
| 
       37 
     | 
    
         
            -
                  sysrandom (>= 1.0.0, < 2.0)
         
     | 
| 
       38 
     | 
    
         
            -
             
     | 
| 
       39 
     | 
    
         
            -
            PLATFORMS
         
     | 
| 
       40 
     | 
    
         
            -
              ruby
         
     | 
| 
       41 
     | 
    
         
            -
             
     | 
| 
       42 
     | 
    
         
            -
            DEPENDENCIES
         
     | 
| 
       43 
     | 
    
         
            -
              bundler (~> 1.16)
         
     | 
| 
       44 
     | 
    
         
            -
              minitest (~> 5.0)
         
     | 
| 
       45 
     | 
    
         
            -
              rake (~> 10.0)
         
     | 
| 
       46 
     | 
    
         
            -
              ulid-rails!
         
     | 
| 
       47 
     | 
    
         
            -
             
     | 
| 
       48 
     | 
    
         
            -
            BUNDLED WITH
         
     | 
| 
       49 
     | 
    
         
            -
               1.16.4
         
     |