Commit 5b973db
Use autoload instead of eager require for generated resource, service, and param files (stripe#1855)
* Convert eager require to autoload for resources, services, and params
Replace ~985 eager require calls with Ruby's autoload in the three
generated barrel files (resources.rb, services.rb, params.rb). This
defers loading of resource classes, service classes, and param classes
until they are first referenced, rather than loading all of them on
require 'stripe'.
Add Stripe.eager_load! for production use — it walks the same file
list in the same order as the old require calls, so there are no
load-order surprises. A Railtie registers Stripe in
config.eager_load_namespaces so Rails calls eager_load! automatically
when config.eager_load is true (the production default).
On Ruby 4.0.2 / Apple M1:
- Boot time: 214ms -> 61ms (-71%)
- Object allocations: 193k -> 35k (-82%)
- Retained memory: 9.0 MB -> 1.4 MB (-85%)
Ref stripe#1432
Co-authored-by: Claude <noreply@anthropic.com>
* Fix lint and typecheck CI failures
- Run rubocop autocorrect to fix line length, trailing whitespace, and
argument alignment in autoload statements
- Exclude lib/stripe/params.rb from CollectionLiteralLength (generated
list, same as existing event_types.rb exclusion)
- Add typed: ignore to railtie files since Rails isn't a Sorbet-visible
dependency
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Committed-By-Agent: claude
* Regenerate resources, services, and params from updated codegen
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Committed-By-Agent: claude
* Remove redundant rubocop.yml exclusion for params.rb
The codegen now emits an inline rubocop:disable comment around the
PARAM_FILES array, making the .rubocop.yml file-level exclusion
unnecessary.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Committed-By-Agent: claude
---------
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Michael Broshi <mbroshi@stripe.com>1 parent 0b1d66f commit 5b973db
7 files changed
Lines changed: 2381 additions & 985 deletions
File tree
- lib
- stripe
- test/stripe
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | 55 | | |
59 | | - | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
68 | 72 | | |
69 | 73 | | |
70 | 74 | | |
| |||
136 | 140 | | |
137 | 141 | | |
138 | 142 | | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
139 | 160 | | |
140 | 161 | | |
141 | 162 | | |
| |||
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
Large diffs are not rendered by default.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
0 commit comments