created_id 1.0.0 → 1.0.1

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: 6aea8a225fcdd235ca56719e20de06dbaa6d4c143dc6d2658e68d95fc59c6d5b
4
- data.tar.gz: 656d93bb31b73415cbeeba237e2c868bb936cb26942e4b03c1cc778e911cf825
3
+ metadata.gz: be6ec5c9e09c606d38aafaedc55cc820060d1a7eb40461b72be62a820463d482
4
+ data.tar.gz: 3c8a7be82f5aa0ba954b1f649aa634432c6b97d0f196d29adb09be069e7c68b7
5
5
  SHA512:
6
- metadata.gz: 85cce04a40800a43b39754ad7686341ba940a1e6fae1e5de90a34dbc6f3c83f346208486d8fbd084dd00b4ff8541df54cd7ef073f894175522fb1bd56e7a0cf3
7
- data.tar.gz: 42c29b10692f1dbfbae7af08b075d1eca605c06ca450d78024794a4965c76cc20bf2d3c0117d7cee324f2f1eee2976fc27261d6dc89ac86ab20961d5ee0b6319
6
+ metadata.gz: a74a5207fda30568768be24de8b55f1554ebe09f157f5d42f00ceda243e6028e6570da3dbdedba713058b65a7f1416c2438d122f4f5bd84c455fb2d7d6418eba
7
+ data.tar.gz: 5b02e4a9f71f2bc5306a49ff56de89f011d829a4972b00240592532a0de390d7a097babadfabec861e93ed2d1acee085a3be5020d397b23331c08b8288e1e576
data/CHANGELOG.md CHANGED
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
4
4
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
5
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## 1.0.1
8
+
9
+ ### Changed
10
+
11
+ - Standardize lazy loading of models.
12
+
7
13
  ## 1.0.0
8
14
 
9
15
  ### Added
data/README.md CHANGED
@@ -1,7 +1,9 @@
1
1
  # Created ID
2
2
 
3
3
  [![Continuous Integration](https://github.com/bdurand/created_id/actions/workflows/continuous_integration.yml/badge.svg)](https://github.com/bdurand/created_id/actions/workflows/continuous_integration.yml)
4
+ [![Regression Test](https://github.com/bdurand/created_id/actions/workflows/regression_test.yml/badge.svg)](https://github.com/bdurand/created_id/actions/workflows/regression_test.yml)
4
5
  [![Ruby Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://github.com/testdouble/standard)
6
+ [![Gem Version](https://badge.fury.io/rb/created_id.svg)](https://badge.fury.io/rb/created_id)
5
7
 
6
8
  The gem is designed to optimize queries for ActiveRecord models that filter by the `created_at` timestamp. It can make queries more efficient by pre-calculating the ranges of id's for specific dates.
7
9
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.0
1
+ 1.0.1
@@ -2,8 +2,5 @@
2
2
 
3
3
  module CreatedId
4
4
  class Engine < Rails::Engine
5
- config.before_eager_load do
6
- require_relative "id_range"
7
- end
8
5
  end
9
6
  end
data/lib/created_id.rb CHANGED
@@ -1,10 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "created_id/version"
4
3
  require_relative "created_id/engine" if defined?(Rails::Engine)
5
4
 
6
5
  module CreatedId
7
6
  extend ActiveSupport::Concern
7
+
8
+ autoload :IdRange, "created_id/id_range"
9
+ autoload :VERSION, "created_id/version"
10
+
8
11
  class CreatedAtChangedError < StandardError
9
12
  end
10
13
 
@@ -21,9 +24,6 @@ module CreatedId
21
24
  raise ArgmentError, "CreatedId can only be included in ActiveRecord models"
22
25
  end
23
26
 
24
- # Require here so we don't mess up loading the activerecord gem.
25
- require_relative "created_id/id_range"
26
-
27
27
  scope :created_after, ->(time) { where(arel_table[:created_at].gteq(time).and(arel_table[primary_key].gteq(CreatedId::IdRange.min_id(self, time)))) }
28
28
  scope :created_before, ->(time) { where(arel_table[:created_at].lt(time).and(arel_table[primary_key].lteq(CreatedId::IdRange.max_id(self, time)))) }
29
29
  scope :created_between, ->(time_1, time_2) { created_after(time_1).created_before(time_2) }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: created_id
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Durand
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-04-28 00:00:00.000000000 Z
11
+ date: 2024-04-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord