encoded_id-rails 1.0.0.rc1 → 1.0.0.rc7

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.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +97 -18
  3. data/LICENSE.txt +1 -1
  4. data/README.md +81 -473
  5. data/context/encoded_id-rails.md +651 -0
  6. data/context/encoded_id.md +437 -0
  7. data/lib/encoded_id/rails/active_record_finders.rb +54 -0
  8. data/lib/encoded_id/rails/annotated_id.rb +14 -9
  9. data/lib/encoded_id/rails/annotated_id_parser.rb +9 -1
  10. data/lib/encoded_id/rails/coder.rb +55 -10
  11. data/lib/encoded_id/rails/composite_id_base.rb +39 -0
  12. data/lib/encoded_id/rails/configuration.rb +66 -10
  13. data/lib/encoded_id/rails/encoder_methods.rb +30 -7
  14. data/lib/encoded_id/rails/finder_methods.rb +11 -0
  15. data/lib/encoded_id/rails/model.rb +60 -7
  16. data/lib/encoded_id/rails/path_param.rb +8 -0
  17. data/lib/encoded_id/rails/persists.rb +55 -9
  18. data/lib/encoded_id/rails/query_methods.rb +21 -4
  19. data/lib/encoded_id/rails/railtie.rb +13 -0
  20. data/lib/encoded_id/rails/salt.rb +8 -0
  21. data/lib/encoded_id/rails/slugged_id.rb +14 -9
  22. data/lib/encoded_id/rails/slugged_id_parser.rb +9 -1
  23. data/lib/encoded_id/rails/slugged_path_param.rb +8 -0
  24. data/lib/encoded_id/rails.rb +11 -6
  25. data/lib/generators/encoded_id/rails/install_generator.rb +36 -2
  26. data/lib/generators/encoded_id/rails/templates/{encoded_id.rb → hashids_encoded_id.rb} +49 -5
  27. data/lib/generators/encoded_id/rails/templates/sqids_encoded_id.rb +116 -0
  28. metadata +16 -24
  29. data/.devcontainer/Dockerfile +0 -17
  30. data/.devcontainer/compose.yml +0 -10
  31. data/.devcontainer/devcontainer.json +0 -12
  32. data/.standard.yml +0 -3
  33. data/Appraisals +0 -9
  34. data/Gemfile +0 -24
  35. data/Rakefile +0 -20
  36. data/Steepfile +0 -4
  37. data/gemfiles/.bundle/config +0 -2
  38. data/gemfiles/rails_7.2.gemfile +0 -19
  39. data/gemfiles/rails_8.0.gemfile +0 -19
  40. data/lib/encoded_id/rails/version.rb +0 -7
  41. data/rbs_collection.yaml +0 -24
  42. data/sig/encoded_id/rails.rbs +0 -141
@@ -1,141 +0,0 @@
1
- module EncodedId
2
- module Rails
3
- VERSION: ::String
4
-
5
- class Configuration
6
- attr_accessor salt: ::String
7
- attr_accessor group_separator: ::String
8
- attr_accessor character_group_size: ::Integer
9
- attr_accessor alphabet: ::EncodedId::Alphabet
10
- attr_accessor id_length: ::Integer
11
- attr_accessor slug_method_name: ::Symbol
12
- attr_accessor slugged_id_separator: ::String
13
- attr_accessor annotation_method_name: ::Symbol
14
- attr_accessor annotated_id_separator: ::String
15
-
16
- def initialize: () -> void
17
- end
18
-
19
- attr_reader self.configuration: Configuration
20
-
21
- def self.configure: () { (Configuration config) -> void } -> void
22
-
23
- class Coder
24
- def initialize: (salt: ::String, id_length: ::Integer, character_group_size: ::Integer, separator: ::String, alphabet: ::EncodedId::Alphabet) -> void
25
- def encode: (::Integer | ::Array[::Integer]) -> String
26
- def decode: (::String) -> ::Array[::Integer]?
27
-
28
- @salt: ::String
29
- @id_length: ::Integer
30
- @character_group_size: ::Integer
31
- @separator: ::String
32
- @alphabet: ::EncodedId::Alphabet
33
-
34
- private
35
-
36
- def coder: -> ::EncodedId::ReversibleId
37
- end
38
-
39
- class Salt
40
- def initialize: (Class klass, ::String salt) -> void
41
-
42
- @klass: Class
43
- @salt: ::String
44
-
45
- def generate!: -> ::String
46
- end
47
-
48
- class SluggedId
49
- def initialize: (slug_part: ::String, id_part: ::String, ?separator: ::String)-> void
50
- @slug_part: ::String
51
- @id_part: ::String
52
- @separator: ::String
53
-
54
- def slugged_id: -> ::String
55
- end
56
-
57
- class AnnotatedId
58
- def initialize: (annotation: ::String, id_part: ::String, ?separator: ::String)-> void
59
- @annotation: ::String
60
- @id_part: ::String
61
- @separator: ::String
62
-
63
- def annotated_id: -> ::String
64
- end
65
-
66
- class SluggedIdParser
67
- def initialize: (::String slugged_id, ?separator: ::String) -> void
68
-
69
- attr_reader slug: ::String?
70
- attr_reader id: ::String
71
- end
72
-
73
- class AnnotatedIdParser
74
- def initialize: (::String annotated_id, ?separator: ::String) -> void
75
-
76
- attr_reader annotation: ::String?
77
- attr_reader id: ::String
78
- end
79
-
80
- module EncoderMethods
81
- def encode_encoded_id: (::Array[::Integer] | ::Integer id, ?::Hash[::Symbol, untyped] options) -> ::String
82
- def decode_encoded_id: (::String slugged_encoded_id, ?::Hash[::Symbol, untyped] options) -> ::Array[::Integer]?
83
- def encoded_id_salt: () -> ::String
84
- def encoded_id_coder: (?::Hash[::Symbol, untyped] options) -> ::EncodedId::Rails::Coder
85
- end
86
-
87
- interface _ActiveRecordFinderMethod
88
- def find_by: (*untyped) -> (nil | untyped)
89
- end
90
-
91
- module FinderMethods : EncoderMethods, _ActiveRecordFinderMethod, _ActiveRecordQueryMethod
92
- def find_by_encoded_id: (::String encoded_id, ?with_id: ::Symbol?) -> untyped?
93
- def find_by_encoded_id!: (::String encoded_id, ?with_id: ::Symbol?) -> untyped
94
- def find_all_by_encoded_id: (::String encoded_id) -> untyped?
95
- def find_all_by_encoded_id!: (::String encoded_id) -> untyped
96
- end
97
-
98
- interface _ActiveRecordQueryMethod
99
- def where: (*untyped) -> untyped
100
- end
101
-
102
- module QueryMethods : EncoderMethods, _ActiveRecordQueryMethod
103
- def where_encoded_id: (::String slugged_encoded_id) -> untyped
104
- end
105
-
106
- module Model : ActiveRecord::Base
107
- # From ActiveRecord
108
- extend ActiveRecord::FinderMethods
109
- extend ActiveRecord::QueryMethods
110
- def id_changed?: -> bool
111
-
112
- # From EncodedId::Rails::Model
113
- extend EncoderMethods
114
- extend FinderMethods
115
- extend QueryMethods
116
-
117
- @encoded_id: ::String
118
- @slugged_encoded_id: ::String
119
-
120
- def encoded_id_hash: -> ::String?
121
- def encoded_id: -> ::String?
122
- def slugged_encoded_id: -> ::String?
123
- def name_for_encoded_id_slug: -> ::String
124
- def annotation_for_encoded_id: -> ::String
125
- end
126
-
127
- interface _ActiveRecordToParam
128
- def to_param: -> ::String
129
- end
130
-
131
- module PathParam : Model, _ActiveRecordToParam
132
- end
133
-
134
- module SluggedPathParam : Model, _ActiveRecordToParam
135
- end
136
- end
137
-
138
- Model: singleton(Rails::Model)
139
- PathParam: singleton(Rails::PathParam)
140
- SluggedPathParam: singleton(Rails::SluggedPathParam)
141
- end