rigortype 0.0.8 → 0.0.9

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/README.md +195 -21
  3. data/data/builtins/ruby_core/encoding.yml +210 -0
  4. data/data/builtins/ruby_core/exception.yml +641 -0
  5. data/data/builtins/ruby_core/numeric.yml +3 -2
  6. data/data/builtins/ruby_core/proc.yml +731 -0
  7. data/data/builtins/ruby_core/random.yml +166 -0
  8. data/data/builtins/ruby_core/re.yml +689 -0
  9. data/data/builtins/ruby_core/struct.yml +449 -0
  10. data/lib/rigor/analysis/runner.rb +19 -3
  11. data/lib/rigor/builtins/imported_refinements.rb +6 -1
  12. data/lib/rigor/cache/rbs_class_ancestor_table.rb +63 -0
  13. data/lib/rigor/cache/rbs_class_type_param_names.rb +60 -0
  14. data/lib/rigor/cache/rbs_constant_table.rb +15 -51
  15. data/lib/rigor/cache/rbs_descriptor.rb +53 -0
  16. data/lib/rigor/cache/rbs_environment.rb +52 -0
  17. data/lib/rigor/cache/rbs_environment_marshal_patch.rb +40 -0
  18. data/lib/rigor/cache/rbs_known_class_names.rb +43 -0
  19. data/lib/rigor/cache/store.rb +79 -15
  20. data/lib/rigor/cli.rb +36 -4
  21. data/lib/rigor/environment/rbs_hierarchy.rb +18 -5
  22. data/lib/rigor/environment/rbs_loader.rb +137 -25
  23. data/lib/rigor/environment.rb +11 -2
  24. data/lib/rigor/flow_contribution.rb +128 -0
  25. data/lib/rigor/inference/builtins/encoding_catalog.rb +67 -0
  26. data/lib/rigor/inference/builtins/exception_catalog.rb +92 -0
  27. data/lib/rigor/inference/builtins/proc_catalog.rb +122 -0
  28. data/lib/rigor/inference/builtins/random_catalog.rb +58 -0
  29. data/lib/rigor/inference/builtins/re_catalog.rb +81 -0
  30. data/lib/rigor/inference/builtins/struct_catalog.rb +55 -0
  31. data/lib/rigor/inference/expression_typer.rb +26 -1
  32. data/lib/rigor/inference/method_dispatcher/constant_folding.rb +16 -1
  33. data/lib/rigor/inference/method_dispatcher/literal_string_folding.rb +87 -0
  34. data/lib/rigor/inference/method_dispatcher.rb +2 -0
  35. data/lib/rigor/inference/narrowing.rb +29 -14
  36. data/lib/rigor/rbs_extended.rb +55 -0
  37. data/lib/rigor/type/combinator.rb +72 -0
  38. data/lib/rigor/type/refined.rb +50 -2
  39. data/lib/rigor/version.rb +1 -1
  40. data/lib/rigor.rb +6 -0
  41. data/sig/rigor.rbs +3 -1
  42. metadata +21 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 38aa66f97f5bed742a36c156ceee7f13d3181597b74c32329b693b3c219852b3
4
- data.tar.gz: 69af0ccbf42c2b890b78a558d574b49293ff6b4880875568137098624e66d3f8
3
+ metadata.gz: b054649005dbeb85c95236ebfba7fe7540e52c10c60aff095fbce81d5b589d67
4
+ data.tar.gz: 9d879aa46bf37164f52f31786bade4d0ede52203d140cf0a2b1571f23160cd7d
5
5
  SHA512:
6
- metadata.gz: 8a9e0ee0461e2f0b2779981fa95758e0b7b5bd02668254dc1cb2d82002565b383d866534edff6e75c53aa0a9ae2fdb59832a35788ccfda3cb4558982bed61b15
7
- data.tar.gz: 9699b63098d16e1959177684a849923384196f0dac55a532a3a0ecdff77d45c76230c3b72a273f59ec237059127007d7bb1ae01be9c9cf8b9613a02033b89bb5
6
+ metadata.gz: ae684fc0749faa78117d85c75550b19e6a8e83b53172feea275d9ae1d804cec4f77d187b7ea4ae66e3035ed722bca0636622785f8537a3c42c9eb4ed9dc10b90
7
+ data.tar.gz: 340b93e08cfcbf7050d6f908aa16e0508250df0cf0d727fb7f5a81f02b312248ee62e403d0046d2c8230cfb71821f4c64d63634bed3eeec276105ad4e663be17
data/README.md CHANGED
@@ -14,14 +14,23 @@ for any class it can find, and reports a small but trustworthy
14
14
  catalogue of bugs (undefined methods on typed receivers, wrong
15
15
  positional arity, provable `Integer / 0`, …).
16
16
 
17
+ The differentiator is a richer type vocabulary than ordinary
18
+ RBS expresses. Rigor reasons about *what values an expression
19
+ actually produces* — literal values, integer ranges,
20
+ refinement-type carriers, per-position tuple / hash shapes —
21
+ not just *which class an object belongs to*. See **[Beyond
22
+ `Integer` and `String`](#beyond-integer-and-string-rigors-richer-type-vocabulary)**
23
+ for the full type-model story; the short pitch is below.
24
+
17
25
  When you want tighter types than RBS expresses, refine them
18
26
  through the
19
27
  [`RBS::Extended`](docs/type-specification/rbs-extended.md)
20
28
  annotation surface — `rigor:v1:return:` /
21
29
  `rigor:v1:param:` / `rigor:v1:assert` directives accept the
22
30
  imported-built-in refinement names (`non-empty-string`,
23
- `positive-int`, `non-empty-array[Integer]`, `int<5, 10>`, …)
24
- without changing the underlying RBS.
31
+ `positive-int`, `non-empty-array[Integer]`, `int<5, 10>`,
32
+ `literal-string`, `non-lowercase-string`, …) without changing
33
+ the underlying RBS.
25
34
 
26
35
  ## Installation
27
36
 
@@ -51,7 +60,7 @@ The gem ships an executable named `rigor` (gem name is
51
60
 
52
61
  **Ruby version.** The gemspec requires `>= 4.0.0, < 4.1`.
53
62
 
54
- ## First analysis
63
+ ## Quick start
55
64
 
56
65
  Drop into your project root and run the canonical commands:
57
66
 
@@ -60,15 +69,15 @@ Drop into your project root and run the canonical commands:
60
69
  # rule-driven bugs across `lib/`.
61
70
  bundle exec rigor check lib
62
71
 
72
+ # Drop a starter .rigor.yml into the project root.
73
+ bundle exec rigor init
74
+
63
75
  # Print the inferred type at a precise FILE:LINE:COL position.
64
76
  bundle exec rigor type-of lib/foo.rb:10:5
65
77
 
66
78
  # Report Scope#type_of coverage across a tree (handy when
67
79
  # diagnosing why a particular call site reads as `untyped`).
68
80
  bundle exec rigor type-scan lib
69
-
70
- # Drop a starter .rigor.yml into the project root.
71
- bundle exec rigor init
72
81
  ```
73
82
 
74
83
  ### Sample output
@@ -90,6 +99,124 @@ RBS or in-source `def` / `define_method` discovery. Implicit-
90
99
  self calls, dynamic receivers, and constant-decl alias classes
91
100
  (e.g. `YAML` → `Psych`) are skipped to avoid false positives.
92
101
 
102
+ ### Faster runs through the cache
103
+
104
+ Rigor caches expensive RBS work (the loaded `RBS::Environment`,
105
+ constant-type translation, class hierarchy, type-parameter
106
+ names, known-class set) under `.rigor/cache/` so the second
107
+ `rigor check` is significantly faster than the first. The cache
108
+ is keyed by your project's `.rbs` file digests + the locked
109
+ `rbs` gem version, so a signature change or a gem upgrade
110
+ invalidates exactly what it should.
111
+
112
+ ```sh
113
+ # Inspect what is cached on disk and what this run did.
114
+ bundle exec rigor check --cache-stats lib
115
+
116
+ # Wipe the cache (do this if you suspect staleness).
117
+ bundle exec rigor check --clear-cache lib
118
+
119
+ # Run with caching disabled.
120
+ bundle exec rigor check --no-cache lib
121
+ ```
122
+
123
+ Add `.rigor/` to your `.gitignore` — the cache is per-checkout
124
+ and contains nothing reproducible to share.
125
+
126
+ ## Beyond `Integer` and `String`: Rigor's richer type vocabulary
127
+
128
+ A vanilla static checker answers "what *class* is this object?"
129
+ Rigor answers a much narrower question: "what *subset of values*
130
+ can this expression actually produce?" That distinction is the
131
+ whole point of Rigor — types like `Integer` and `String` describe
132
+ classes, but real-world code carries far more structure (a count
133
+ that's always non-negative, a name that's never empty, a flag
134
+ that's one of three Symbols). Rigor reasons about that structure
135
+ out of the box, without you writing a single annotation.
136
+
137
+ ### The carrier zoo
138
+
139
+ | Carrier | What it records | Example |
140
+ | --- | --- | --- |
141
+ | **Literal types** (`Type::Constant`) | A single Ruby value | `Constant<42>`, `Constant<"hello">`, `Constant<:foo>` |
142
+ | **Integer ranges** (`Type::IntegerRange`) | A bounded integer interval `int<a, b>` | `positive-int = int<1, max>`, `int<5, 10>` |
143
+ | **Refinement types** — split into two halves: `Type::Difference` and `Type::Refined` | A base nominal minus a single value, or a base nominal restricted by a predicate | `non-empty-string = String - ""`, `lowercase-string = String & lowercase?`, `literal-string` |
144
+ | **Intersection** (`Type::Intersection`) | Composition of multiple refinements | `non-empty-lowercase-string = non-empty-string ∩ lowercase-string` |
145
+ | **Tuple / HashShape** | Heterogeneous arrays / known-key hashes that carry per-position / per-key types | `[1, "two", :three]` types as `Tuple[Constant<1>, Constant<"two">, Constant<:three>]`; `{name: "Alice", age: 30}` as `HashShape{name: Constant<"Alice">, age: Constant<30>}` |
146
+ | **Union** (`Type::Union`) | "One of these literal values" — finite enums Rigor can enumerate | `Constant<:zero> \| Constant<:small> \| Constant<:large>` |
147
+ | **`Dynamic[T]`** | The gradual carrier — wraps a static facet with a "could be anything" admission | `Dynamic[Top]` is the conservative fallback Rigor uses when it cannot prove a narrower type |
148
+
149
+ Each refinement / range / literal carrier **erases to its base
150
+ class** for ordinary RBS interop, so importing Rigor is a
151
+ strictly additive change: a method whose RBS sig says
152
+ `-> String` keeps that contract, and Rigor's narrower inference
153
+ just sits on top.
154
+
155
+ ### What this buys you in practice
156
+
157
+ ```ruby
158
+ # Rigor doesn't just see "Integer", it sees "non-negative integer".
159
+ n = ARGV.size # int<0, max> (non-negative-int)
160
+ m = n + 1 # int<1, max> (positive-int)
161
+ m.zero? # Constant<false> — proven; the
162
+ # branch elision can drop the `else`
163
+
164
+ # String composition stays as precise as the inputs allow.
165
+ greeting = "Hello, " # Constant<"Hello, ">
166
+ name = ARGV.first # String? — RBS-declared
167
+ hello = "Hello, #{name}!" # literal-string — every part is
168
+ # literal-bearing, so the result is
169
+ # provably source-derived.
170
+
171
+ # Tuple-shaped destructuring stays per-position.
172
+ first, _middle, last = [10, 20, 30]
173
+ first # Constant<10>
174
+ last # Constant<30>
175
+
176
+ # Constant folding through user methods.
177
+ def is_odd(n) = n.odd?
178
+ is_odd(3) # Constant<true> — folded through
179
+ # the body, not just typed as `bool`
180
+
181
+ # Case/when narrowing produces a literal-set Union.
182
+ label = case n
183
+ when 0 then :zero
184
+ when 1..9 then :small
185
+ else :large
186
+ end
187
+ label # Constant<:zero> | Constant<:small>
188
+ # | Constant<:large>
189
+
190
+ # RBS::Extended directives let you tighten beyond what RBS expresses.
191
+ class Slug
192
+ %a{rigor:v1:return: non-empty-string}
193
+ def normalise: (::String id) -> ::String
194
+ end
195
+ Slug.new.normalise("foo").size # positive-int — provably ≥ 1
196
+ ```
197
+
198
+ Rigor never invents these answers — every narrower carrier is
199
+ derived from literals in the source, control-flow narrowing
200
+ (`is_a?`, `nil?`, `==` against finite literal sets, integer
201
+ comparisons), per-class catalogues for the bundled built-ins,
202
+ or `RBS::Extended` directives the user opted into. When the
203
+ inference cannot prove a value is in a narrower carrier, it
204
+ stays at the wider one (or `Dynamic[Top]`) and Rigor stays
205
+ silent — diagnostics fire only when the narrow type is
206
+ genuinely proved.
207
+
208
+ ### Where the type model is documented
209
+
210
+ - One-page mental model:
211
+ [`docs/types.md`](docs/types.md).
212
+ - Binding spec corpus:
213
+ [`docs/type-specification/`](docs/type-specification/README.md).
214
+ - Imported refinement names (kebab-case catalogue):
215
+ [`docs/type-specification/imported-built-in-types.md`](docs/type-specification/imported-built-in-types.md).
216
+ - The `RBS::Extended` annotation grammar that opens this
217
+ vocabulary up to your own RBS:
218
+ [`docs/type-specification/rbs-extended.md`](docs/type-specification/rbs-extended.md).
219
+
93
220
  ## How Rigor finds your types
94
221
 
95
222
  Rigor consults, in order:
@@ -102,8 +229,9 @@ Rigor consults, in order:
102
229
  3. **Gem RBS.** RBS files vendored with installed gems
103
230
  (Prism's own `.rbs`, the `rbs` gem's, …).
104
231
  4. **In-source class discovery.** When no RBS is available,
105
- Rigor walks `def` / `define_method` / `attr_*` so
106
- user-defined methods on a class are recognised.
232
+ Rigor walks `def` / `define_method` / `attr_*` /
233
+ `Data.define(*Symbol)` so user-defined methods on a class
234
+ are recognised.
107
235
 
108
236
  If a type cannot be proved, the engine returns `Dynamic[Top]`
109
237
  (Rigor's gradual carrier) and stays silent — Rigor never invents
@@ -139,8 +267,17 @@ Right-hand side accepts:
139
267
  - Predicate refinements — `lowercase-string`,
140
268
  `uppercase-string`, `numeric-string`, `decimal-int-string`,
141
269
  `octal-int-string`, `hex-int-string`.
270
+ - Paired complements (`~T`-symmetric) —
271
+ `non-lowercase-string`, `non-uppercase-string`,
272
+ `non-numeric-string`. Writing `~lowercase-string` narrows
273
+ `String` to `non-lowercase-string` instead of the generic
274
+ `Difference[String, lowercase-string]` fallback.
142
275
  - Composed shapes — `non-empty-lowercase-string`,
143
- `non-empty-uppercase-string`.
276
+ `non-empty-uppercase-string`, `non-empty-literal-string`.
277
+ - Flow-tracked source-literal — `literal-string`. Rigor lifts
278
+ `"hi #{name}!"`, `"a" + literal_str`, and `literal_str * 3`
279
+ to `literal-string` when every operand is itself
280
+ literal-bearing.
144
281
 
145
282
  The full directive table is in
146
283
  [`docs/type-specification/rbs-extended.md`](docs/type-specification/rbs-extended.md);
@@ -191,26 +328,38 @@ sees `id` as `non-empty-string` (so `id.empty?` reduces to
191
328
  - **Predicate narrowing** — truthiness, `nil?`, `is_a?` /
192
329
  `kind_of?` / `instance_of?`, finite-literal equality,
193
330
  case-equality (`===`) for Class / Module / Range / Regexp,
194
- `case` / `when` integration.
331
+ `case` / `when` integration. Paired-complement narrowing for
332
+ Refined predicates (`~lowercase-string` →
333
+ `non-lowercase-string`).
195
334
  - **Tuple / HashShape carriers** — shape-aware element access,
196
335
  range / start-length slices, closed / open / required /
197
- optional policies.
336
+ optional policies, per-element block fold over
337
+ `map`, `select`, `filter_map`, `flat_map`, `find` /
338
+ `find_index`, `count`, `any?` / `all?` / `none?`, `zip`.
198
339
  - **Constant folding** — aggressive arithmetic / string /
199
340
  Symbol / Tuple-shaped `divmod` folding, cartesian fold over
200
341
  `Union[Constant…]`, integer-range arithmetic
201
342
  (`positive-int + 1` → `int<2, max>`), branch elision on
202
- provably-truthy / falsey predicates.
203
- - **Built-in catalogues** — Numeric, String, Symbol, Array,
204
- IO, File, Hash, Range, Set, Time. Each catalog drives the
205
- fold dispatcher with per-class blocklists for indirect
206
- mutators.
343
+ provably-truthy / falsey predicates,
344
+ `Constant<String>#%` format-string fold against
345
+ `Tuple` / `HashShape` arguments.
346
+ - **Built-in catalogues** Numeric / Integer / Float, String /
347
+ Symbol, Array, Hash, IO, File, Range, Set, Time, Date /
348
+ DateTime, Comparable, Enumerable, Rational, Complex,
349
+ Pathname, Random, Struct (+ `Data`), Encoding, Regexp /
350
+ MatchData, Proc / Method / UnboundMethod, Exception. Each
351
+ catalog drives the fold dispatcher with per-class blocklists
352
+ for indirect mutators.
207
353
  - **Refinement carriers** — `Type::Difference`,
208
354
  `Type::Refined`, `Type::Intersection` provide the
209
355
  imported-built-in catalogue end-to-end through
210
356
  `Builtins::ImportedRefinements`.
211
357
  - **`RBS::Extended` directive routes** — `return:`, `param:`
212
358
  (call-site + body-side), `assert:` /
213
- `predicate-if-(true|false)` accept refinement payloads.
359
+ `predicate-if-(true|false)` accept refinement payloads, and
360
+ roll up into a single `Rigor::FlowContribution` bundle per
361
+ method (the v0.1.0 plugin contribution merger reads bundles
362
+ directly).
214
363
 
215
364
  The full per-release surface lives in
216
365
  [`CHANGELOG.md`](CHANGELOG.md). The internal contracts the
@@ -226,19 +375,42 @@ bundle exec rigor init # fails if .rigor.yml exists
226
375
  bundle exec rigor init --force # overwrite
227
376
  ```
228
377
 
229
- The configuration is intentionally small in v0.0.x; see the
230
- generated file for the available knobs.
378
+ Common knobs the file exposes:
379
+
380
+ - `paths` — directories `rigor check` and `rigor type-scan`
381
+ scan when no path is given (defaults to `lib`).
382
+ - `target_ruby` — minimum Ruby version your project targets.
383
+ - `libraries` — extra stdlib libraries to load on top of the
384
+ bundled defaults (e.g. `["csv", "set"]`).
385
+ - `signature_paths` — explicit list of `sig/`-style directories.
386
+ Leave unset (or `null`) to auto-detect `<root>/sig`. Use `[]`
387
+ to disable project-RBS loading entirely.
388
+ - `disable` — rule identifiers to silence project-wide. Shipped
389
+ rules: `undefined-method`, `wrong-arity`,
390
+ `argument-type-mismatch`, `possible-nil-receiver`,
391
+ `dump-type`, `assert-type`, `always-raises`. In-source
392
+ `# rigor:disable <rule>` end-of-line comments silence
393
+ per-line; `# rigor:disable all` suppresses every rule.
231
394
 
232
395
  ## Status
233
396
 
234
- Current release: **`v0.0.4`** (the fourth preview). The
235
- analyzer is usable on real Ruby code today but the rule
397
+ Current released version: **`v0.0.8`** (the eighth preview).
398
+ The analyzer is usable on real Ruby code today but the rule
236
399
  catalogue is deliberately narrow — Rigor's stance is to surface
237
400
  zero false positives while the inference surface stabilises.
238
401
  The roadmap is tracked in
239
402
  [`docs/MILESTONES.md`](docs/MILESTONES.md); release-by-release
240
403
  detail lives in [`CHANGELOG.md`](CHANGELOG.md).
241
404
 
405
+ `v0.0.9` is the active development cluster on `master` and
406
+ covers the persistent cache infrastructure (`.rigor/cache/`,
407
+ `--cache-stats`, `--clear-cache`, `--no-cache`),
408
+ paired-complement Refined narrowing, `literal-string` flow
409
+ tracking, the `Rigor::FlowContribution` bundle struct, and
410
+ six additional built-in catalogues (Random, Struct, Encoding,
411
+ Regexp + MatchData, Proc / Method / UnboundMethod, Exception).
412
+ The next release after `0.0.9` will be `0.1.0`.
413
+
242
414
  ## Contributing
243
415
 
244
416
  See [`CONTRIBUTING.md`](CONTRIBUTING.md) for the minimal
@@ -248,3 +420,5 @@ skill documentation contributors should know about.
248
420
  ## License
249
421
 
250
422
  Mozilla Public License Version 2.0. See [`LICENSE`](LICENSE).
423
+ </content>
424
+ </invoke>
@@ -0,0 +1,210 @@
1
+ # DO NOT EDIT — generated by tool/extract_builtin_catalog.rb
2
+ ---
3
+ schema_version: 1
4
+ generated_from:
5
+ ruby_init_c: references/ruby/encoding.c
6
+ ruby_prelude:
7
+ rbs:
8
+ - references/rbs/core/encoding.rbs
9
+ purity_levels:
10
+ leaf: Prelude :leaf marker (VM-enforced) or C body uses no dispatch/yield/mutation.
11
+ trivial: Prelude method body is a literal return (self/true/false/nil/Integer).
12
+ leaf_when_numeric: C body falls through to rb_num_coerce_* only when an operand
13
+ is non-numeric; safe to fold when every argument is a concrete numeric.
14
+ inline_block: Prelude method carries :inline_block or :use_block; block-dependent.
15
+ block_dependent: C body yields or checks rb_block_given_p.
16
+ mutates_self: C body checks rb_check_frozen — typically a prelude to mutation.
17
+ dispatch: C body calls user-redefinable methods (rb_funcall*, rb_equal, rb_Float,
18
+ num_funcall*, etc).
19
+ unknown: C body not located in indexed C files.
20
+ classes:
21
+ Encoding:
22
+ parent: Object
23
+ defined_at: references/ruby/encoding.c:1992
24
+ includes: []
25
+ constants: {}
26
+ aliases:
27
+ to_s:
28
+ old: name
29
+ source: c
30
+ defined_at: references/ruby/encoding.c:2001
31
+ instance_methods:
32
+ inspect:
33
+ source: c
34
+ cfunc: enc_inspect
35
+ arity: 0
36
+ defined_at: references/ruby/encoding.c:2003
37
+ c_body_at: references/ruby/encoding.c:1344
38
+ c_effects:
39
+ - raises
40
+ purity: leaf
41
+ rbs:
42
+ - "() -> String"
43
+ rbs_at: references/rbs/core/encoding.rbs:281
44
+ names:
45
+ source: c
46
+ cfunc: enc_names
47
+ arity: 0
48
+ defined_at: references/ruby/encoding.c:2004
49
+ c_body_at: references/ruby/encoding.c:1384
50
+ c_effects: []
51
+ purity: leaf
52
+ rbs:
53
+ - "() -> Array[String]"
54
+ rbs_at: references/rbs/core/encoding.rbs:298
55
+ dummy?:
56
+ source: c
57
+ cfunc: enc_dummy_p
58
+ arity: 0
59
+ defined_at: references/ruby/encoding.c:2005
60
+ c_body_at: references/ruby/encoding.c:663
61
+ c_effects: []
62
+ purity: leaf
63
+ rbs:
64
+ - "() -> bool"
65
+ rbs_at: references/rbs/core/encoding.rbs:270
66
+ ascii_compatible?:
67
+ source: c
68
+ cfunc: enc_ascii_compatible_p
69
+ arity: 0
70
+ defined_at: references/ruby/encoding.c:2006
71
+ c_body_at: references/ruby/encoding.c:679
72
+ c_effects: []
73
+ purity: leaf
74
+ rbs:
75
+ - "() -> bool"
76
+ rbs_at: references/rbs/core/encoding.rbs:257
77
+ _dump:
78
+ source: c
79
+ cfunc: enc_dump
80
+ arity: -1
81
+ defined_at: references/ruby/encoding.c:2013
82
+ c_body_at: references/ruby/encoding.c:1502
83
+ c_effects: []
84
+ purity: leaf
85
+ singleton_methods:
86
+ list:
87
+ source: c
88
+ cfunc: enc_list
89
+ arity: 0
90
+ defined_at: references/ruby/encoding.c:2007
91
+ c_body_at: references/ruby/encoding.c:1416
92
+ c_effects: []
93
+ purity: leaf
94
+ rbs:
95
+ - "() -> Array[Encoding]"
96
+ rbs_at: references/rbs/core/encoding.rbs:232
97
+ name_list:
98
+ source: c
99
+ cfunc: rb_enc_name_list
100
+ arity: 0
101
+ defined_at: references/ruby/encoding.c:2008
102
+ c_body_at: references/ruby/encoding.c:1895
103
+ c_effects: []
104
+ purity: leaf
105
+ rbs:
106
+ - "() -> Array[String]"
107
+ rbs_at: references/rbs/core/encoding.rbs:246
108
+ aliases:
109
+ source: c
110
+ cfunc: rb_enc_aliases
111
+ arity: 0
112
+ defined_at: references/ruby/encoding.c:2009
113
+ c_body_at: references/ruby/encoding.c:1941
114
+ c_effects: []
115
+ purity: leaf
116
+ rbs:
117
+ - "() -> Hash[String, String]"
118
+ rbs_at: references/rbs/core/encoding.rbs:66
119
+ find:
120
+ source: c
121
+ cfunc: enc_find
122
+ arity: 1
123
+ defined_at: references/ruby/encoding.c:2010
124
+ c_body_at: references/ruby/encoding.c:1445
125
+ c_effects: []
126
+ purity: leaf
127
+ rbs:
128
+ - "(encoding enc) -> Encoding?"
129
+ rbs_at: references/rbs/core/encoding.rbs:213
130
+ compatible?:
131
+ source: c
132
+ cfunc: enc_compatible_p
133
+ arity: 2
134
+ defined_at: references/ruby/encoding.c:2011
135
+ c_body_at: references/ruby/encoding.c:1480
136
+ c_effects: []
137
+ purity: leaf
138
+ rbs:
139
+ - "(untyped obj1, untyped obj2) -> Encoding?"
140
+ rbs_at: references/rbs/core/encoding.rbs:91
141
+ _load:
142
+ source: c
143
+ cfunc: enc_load
144
+ arity: 1
145
+ defined_at: references/ruby/encoding.c:2014
146
+ c_body_at: references/ruby/encoding.c:1510
147
+ c_effects: []
148
+ purity: leaf
149
+ rbs:
150
+ - "[T] (T) -> T"
151
+ rbs_at: references/rbs/core/encoding.rbs:30
152
+ default_external:
153
+ source: c
154
+ cfunc: get_default_external
155
+ arity: 0
156
+ defined_at: references/ruby/encoding.c:2016
157
+ c_body_at: references/ruby/encoding.c:1704
158
+ c_effects: []
159
+ purity: leaf
160
+ rbs:
161
+ - "() -> Encoding"
162
+ rbs_at: references/rbs/core/encoding.rbs:121
163
+ default_external=:
164
+ source: c
165
+ cfunc: set_default_external
166
+ arity: 1
167
+ defined_at: references/ruby/encoding.c:2017
168
+ c_body_at: references/ruby/encoding.c:1733
169
+ c_effects: []
170
+ purity: leaf
171
+ rbs:
172
+ - "(Encoding enc) -> Encoding"
173
+ - "[T < _ToStr] (T enc) -> T"
174
+ rbs_at: references/rbs/core/encoding.rbs:135
175
+ default_internal:
176
+ source: c
177
+ cfunc: get_default_internal
178
+ arity: 0
179
+ defined_at: references/ruby/encoding.c:2018
180
+ c_body_at: references/ruby/encoding.c:1787
181
+ c_effects: []
182
+ purity: leaf
183
+ rbs:
184
+ - "() -> Encoding?"
185
+ rbs_at: references/rbs/core/encoding.rbs:166
186
+ default_internal=:
187
+ source: c
188
+ cfunc: set_default_internal
189
+ arity: 1
190
+ defined_at: references/ruby/encoding.c:2019
191
+ c_body_at: references/ruby/encoding.c:1813
192
+ c_effects: []
193
+ purity: leaf
194
+ rbs:
195
+ - "(Encoding enc) -> Encoding"
196
+ - "[T < _ToStr] (T enc) -> T"
197
+ - "(nil) -> nil"
198
+ rbs_at: references/rbs/core/encoding.rbs:181
199
+ locale_charmap:
200
+ source: c
201
+ cfunc: rb_locale_charmap
202
+ arity: 0
203
+ defined_at: references/ruby/encoding.c:2020
204
+ purity: unknown
205
+ c_body_at: not_found
206
+ rbs:
207
+ - "() -> String"
208
+ rbs_at: references/rbs/core/encoding.rbs:54
209
+ undefined:
210
+ - new