rigortype 0.2.0 → 0.2.2

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 (142) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +82 -20
  3. data/data/core_overlay/numeric.rbs +33 -0
  4. data/data/core_overlay/pathname.rbs +25 -0
  5. data/data/core_overlay/string_scanner.rbs +28 -0
  6. data/data/gem_overlay/activesupport/core_ext.rbs +473 -0
  7. data/data/vendored_gem_sigs/ast/ast.rbs +130 -0
  8. data/data/vendored_gem_sigs/bcrypt/bcrypt.rbs +47 -0
  9. data/data/vendored_gem_sigs/bundler/bundler.rbs +238 -0
  10. data/data/vendored_gem_sigs/cgi/cgi_extras.rbs +34 -0
  11. data/data/vendored_gem_sigs/did_you_mean/did_you_mean_extras.rbs +34 -0
  12. data/data/vendored_gem_sigs/idn-ruby/idn.rbs +54 -0
  13. data/data/vendored_gem_sigs/mysql2/client.rbs +55 -0
  14. data/data/vendored_gem_sigs/mysql2/error.rbs +5 -0
  15. data/data/vendored_gem_sigs/mysql2/result.rbs +31 -0
  16. data/data/vendored_gem_sigs/mysql2/statement.rbs +5 -0
  17. data/data/vendored_gem_sigs/nokogiri/nokogiri.rbs +2332 -0
  18. data/data/vendored_gem_sigs/nokogiri/nokogiri_html5.rbs +47 -0
  19. data/data/vendored_gem_sigs/pg/pg.rbs +212 -0
  20. data/data/vendored_gem_sigs/prism/prism_supplement.rbs +44 -0
  21. data/data/vendored_gem_sigs/redis/errors.rbs +50 -0
  22. data/data/vendored_gem_sigs/redis/future.rbs +5 -0
  23. data/data/vendored_gem_sigs/redis/redis.rbs +348 -0
  24. data/data/vendored_gem_sigs/redis/redis_extras.rbs +130 -0
  25. data/data/vendored_gem_sigs/rubygems/rubygems_extras.rbs +226 -0
  26. data/docs/handbook/01-getting-started.md +311 -0
  27. data/docs/handbook/02-everyday-types.md +337 -0
  28. data/docs/handbook/03-narrowing.md +359 -0
  29. data/docs/handbook/04-tuples-and-shapes.md +321 -0
  30. data/docs/handbook/05-methods-and-blocks.md +339 -0
  31. data/docs/handbook/06-classes.md +305 -0
  32. data/docs/handbook/07-rbs-and-extended.md +427 -0
  33. data/docs/handbook/08-understanding-errors.md +373 -0
  34. data/docs/handbook/09-plugins.md +241 -0
  35. data/docs/handbook/10-sorbet.md +347 -0
  36. data/docs/handbook/11-sig-gen.md +312 -0
  37. data/docs/handbook/12-lightweight-hkt.md +333 -0
  38. data/docs/handbook/README.md +275 -0
  39. data/docs/handbook/appendix-elixir.md +370 -0
  40. data/docs/handbook/appendix-go.md +399 -0
  41. data/docs/handbook/appendix-java-csharp.md +470 -0
  42. data/docs/handbook/appendix-liskov.md +580 -0
  43. data/docs/handbook/appendix-mypy.md +370 -0
  44. data/docs/handbook/appendix-phpstan.md +338 -0
  45. data/docs/handbook/appendix-protocols-and-structural-typing.md +292 -0
  46. data/docs/handbook/appendix-rust.md +446 -0
  47. data/docs/handbook/appendix-steep.md +336 -0
  48. data/docs/handbook/appendix-type-theory.md +1662 -0
  49. data/docs/handbook/appendix-typeprof.md +416 -0
  50. data/docs/handbook/appendix-typescript.md +332 -0
  51. data/docs/install.md +189 -0
  52. data/docs/llms.txt +72 -0
  53. data/docs/manual/01-installation.md +342 -0
  54. data/docs/manual/02-cli-reference.md +557 -0
  55. data/docs/manual/03-configuration.md +152 -0
  56. data/docs/manual/04-diagnostics.md +206 -0
  57. data/docs/manual/05-inspecting-types.md +109 -0
  58. data/docs/manual/06-baseline.md +104 -0
  59. data/docs/manual/07-plugins.md +92 -0
  60. data/docs/manual/08-skills.md +143 -0
  61. data/docs/manual/09-editor-integration.md +245 -0
  62. data/docs/manual/10-mcp-server.md +532 -0
  63. data/docs/manual/11-ci.md +274 -0
  64. data/docs/manual/12-caching.md +116 -0
  65. data/docs/manual/13-troubleshooting.md +120 -0
  66. data/docs/manual/14-rails-quickstart.md +332 -0
  67. data/docs/manual/15-type-protection-coverage.md +204 -0
  68. data/docs/manual/16-rbs-extended-annotations.md +190 -0
  69. data/docs/manual/17-driving-improvement.md +160 -0
  70. data/docs/manual/README.md +87 -0
  71. data/docs/manual/ci-templates/README.md +58 -0
  72. data/docs/manual/plugins/README.md +86 -0
  73. data/docs/manual/plugins/rigor-actioncable.md +78 -0
  74. data/docs/manual/plugins/rigor-actionmailer.md +74 -0
  75. data/docs/manual/plugins/rigor-actionpack.md +80 -0
  76. data/docs/manual/plugins/rigor-activejob.md +58 -0
  77. data/docs/manual/plugins/rigor-activerecord.md +102 -0
  78. data/docs/manual/plugins/rigor-activestorage.md +74 -0
  79. data/docs/manual/plugins/rigor-activesupport-core-ext.md +86 -0
  80. data/docs/manual/plugins/rigor-devise.md +70 -0
  81. data/docs/manual/plugins/rigor-dry-schema.md +56 -0
  82. data/docs/manual/plugins/rigor-dry-struct.md +60 -0
  83. data/docs/manual/plugins/rigor-dry-types.md +59 -0
  84. data/docs/manual/plugins/rigor-dry-validation.md +62 -0
  85. data/docs/manual/plugins/rigor-factorybot.md +76 -0
  86. data/docs/manual/plugins/rigor-graphql.md +89 -0
  87. data/docs/manual/plugins/rigor-hanami.md +83 -0
  88. data/docs/manual/plugins/rigor-mangrove.md +73 -0
  89. data/docs/manual/plugins/rigor-minitest.md +86 -0
  90. data/docs/manual/plugins/rigor-pundit.md +72 -0
  91. data/docs/manual/plugins/rigor-rails-i18n.md +92 -0
  92. data/docs/manual/plugins/rigor-rails-routes.md +94 -0
  93. data/docs/manual/plugins/rigor-rails.md +44 -0
  94. data/docs/manual/plugins/rigor-rbs-inline.md +83 -0
  95. data/docs/manual/plugins/rigor-rspec-rails.md +72 -0
  96. data/docs/manual/plugins/rigor-rspec.md +86 -0
  97. data/docs/manual/plugins/rigor-shoulda-matchers.md +78 -0
  98. data/docs/manual/plugins/rigor-sidekiq.md +78 -0
  99. data/docs/manual/plugins/rigor-sinatra.md +61 -0
  100. data/docs/manual/plugins/rigor-sorbet.md +63 -0
  101. data/docs/manual/plugins/rigor-statesman.md +75 -0
  102. data/docs/manual/plugins/rigor-typescript-utility-types.md +71 -0
  103. data/exe/rigor +1 -1
  104. data/lib/rigor/analysis/incremental_session.rb +4 -2
  105. data/lib/rigor/analysis/run_stats.rb +13 -1
  106. data/lib/rigor/analysis/runner.rb +54 -12
  107. data/lib/rigor/cli/check_command.rb +26 -3
  108. data/lib/rigor/cli/coverage_command.rb +67 -92
  109. data/lib/rigor/cli/coverage_mutation.rb +149 -0
  110. data/lib/rigor/cli/docs_command.rb +248 -0
  111. data/lib/rigor/cli/fused_protection_renderer.rb +67 -0
  112. data/lib/rigor/cli/fused_protection_report.rb +76 -0
  113. data/lib/rigor/cli/skill_command.rb +103 -41
  114. data/lib/rigor/cli/skill_describe.rb +346 -0
  115. data/lib/rigor/cli.rb +25 -3
  116. data/lib/rigor/config_audit.rb +152 -0
  117. data/lib/rigor/configuration.rb +12 -0
  118. data/lib/rigor/environment/rbs_loader.rb +27 -0
  119. data/lib/rigor/environment.rb +49 -1
  120. data/lib/rigor/inference/method_dispatcher/constant_folding.rb +140 -38
  121. data/lib/rigor/inference/method_dispatcher/shape_dispatch.rb +37 -6
  122. data/lib/rigor/inference/scope_indexer.rb +87 -89
  123. data/lib/rigor/inference/statement_evaluator.rb +27 -0
  124. data/lib/rigor/plugin/isolation.rb +5 -5
  125. data/lib/rigor/plugin/loader.rb +4 -2
  126. data/lib/rigor/protection/diagnostic_oracle.rb +51 -0
  127. data/lib/rigor/protection/mutation_scanner.rb +98 -38
  128. data/lib/rigor/protection/mutator.rb +21 -0
  129. data/lib/rigor/protection/test_suite_oracle.rb +68 -0
  130. data/lib/rigor/signature_path_audit.rb +92 -0
  131. data/lib/rigor/version.rb +1 -1
  132. data/skills/rigor-ask/SKILL.md +172 -0
  133. data/skills/rigor-doctor/SKILL.md +87 -0
  134. data/skills/rigor-editor-setup/SKILL.md +114 -0
  135. data/skills/rigor-mcp-setup/SKILL.md +117 -0
  136. data/skills/rigor-monkeypatch-resolve/SKILL.md +79 -0
  137. data/skills/rigor-next-steps/SKILL.md +113 -0
  138. data/skills/rigor-plugin-tune/SKILL.md +79 -0
  139. data/skills/rigor-protection-uplift/SKILL.md +133 -0
  140. data/skills/rigor-rbs-setup/SKILL.md +128 -0
  141. data/skills/rigor-upgrade/SKILL.md +79 -0
  142. metadata +120 -1
@@ -0,0 +1,238 @@
1
+ #
2
+ # Rigor-side vendored RBS stub for the `bundler` gem.
3
+ #
4
+ # The `bundler` gem does not ship its own `sig/` and is not
5
+ # covered by `ruby/gem_rbs_collection`. The shim in
6
+ # `references/rbs/sig/shims/bundler.rbs` (rbs gem upstream)
7
+ # carries a tiny subset (`LockfileParser`, `LazySpecification`,
8
+ # `Dependency`, `Definition`, `default_lockfile`, `definition`,
9
+ # `Source::Gemspec`) but is only loaded when the user opts in via
10
+ # `library "bundler"` — that's rare in Rigor `.rigor.yml` setups,
11
+ # so most projects analyse bundler-using code with NO `Bundler`
12
+ # RBS in scope.
13
+ #
14
+ # This stub covers the Bundler module's top-25 singleton methods
15
+ # surfaced by the `references/ruby/lib` survey
16
+ # (`docs/CURRENT_WORK.md`), plus the handful of class-level
17
+ # entries (`Definition`, `LockfileParser`, `LazySpecification`,
18
+ # `Dependency`, `ConfigFile`, `Settings`, `UI`) that downstream
19
+ # Rigor users routinely touch. Most return types are `untyped`
20
+ # because Bundler's surface is dynamic / opaque; the goal is to
21
+ # silence `call.undefined-method` rather than infer precise
22
+ # returns.
23
+ #
24
+ # Declarations are intentionally a SUPERSET of the
25
+ # `references/rbs/sig/shims/bundler.rbs` shim. When the user
26
+ # opts into `library "bundler"`, the shim's typed declarations
27
+ # (`LockfileParser#specs -> Array[LazySpecification]`, etc.)
28
+ # would conflict; users who want both should drop the
29
+ # `library "bundler"` entry from their config so this vendored
30
+ # stub wins.
31
+ #
32
+ module Bundler
33
+ # `Bundler.<name>` — accessors / module-level entry points.
34
+ # Return types: `untyped` unless the surface is documented and
35
+ # widely-used (`bundle_path` -> Pathname).
36
+ def self.configure: () -> untyped
37
+ def self.ui: () -> untyped
38
+ def self.ui=: (untyped) -> untyped
39
+ def self.bundle_path: () -> Pathname
40
+ def self.create_bundle_path: () -> Pathname
41
+ def self.configured_bundle_path: () -> untyped
42
+ def self.bin_path: () -> Pathname
43
+ def self.setup: (*untyped groups) -> untyped
44
+ def self.auto_switch: () -> untyped
45
+ def self.auto_install: () -> untyped
46
+ def self.require: (*untyped groups) -> untyped
47
+ def self.load: () -> untyped
48
+ def self.environment: () -> untyped
49
+ def self.definition: (?untyped unlock, ?untyped lockfile) -> Definition
50
+ def self.frozen_bundle?: () -> bool
51
+ def self.locked_gems: () -> untyped
52
+ def self.ruby_scope: () -> String
53
+ def self.user_home: () -> Pathname
54
+ def self.user_bundle_path: (?untyped dir) -> Pathname
55
+ def self.user_cache: () -> Pathname
56
+ def self.home: () -> Pathname
57
+ def self.install_path: () -> Pathname
58
+ def self.specs_path: () -> Pathname
59
+ def self.root: () -> Pathname
60
+ def self.app_config_path: () -> Pathname
61
+ def self.app_cache: (?untyped custom_path) -> Pathname
62
+ def self.tmp: (?untyped name) -> Pathname
63
+ def self.rm_rf: (untyped path) -> untyped
64
+ def self.settings: () -> untyped
65
+ def self.original_env: () -> Hash[String, String]
66
+ def self.clean_env: () -> Hash[String, String]
67
+ def self.unbundled_env: () -> Hash[String, String]
68
+ def self.unbundle_env!: () -> untyped
69
+ def self.with_original_env: () { () -> untyped } -> untyped
70
+ def self.with_clean_env: () { () -> untyped } -> untyped
71
+ def self.with_unbundled_env: () { () -> untyped } -> untyped
72
+ def self.original_system: (*untyped) -> untyped
73
+ def self.clean_system: (*untyped) -> untyped
74
+ def self.unbundled_system: (*untyped) -> untyped
75
+ def self.original_exec: (*untyped) -> untyped
76
+ def self.clean_exec: (*untyped) -> untyped
77
+ def self.unbundled_exec: (*untyped) -> untyped
78
+ def self.local_platform: () -> untyped
79
+ def self.generic_local_platform: () -> untyped
80
+ def self.default_gemfile: () -> Pathname
81
+ def self.default_lockfile: () -> Pathname
82
+ def self.default_bundle_dir: () -> Pathname?
83
+ def self.system_bindir: () -> String?
84
+ def self.preferred_gemfile_name: () -> String
85
+ def self.use_system_gems?: () -> bool
86
+ def self.rubygems: () -> untyped
87
+ def self.which: (untyped) -> String?
88
+ def self.load_gemspec: (untyped path, ?bool validate) -> untyped
89
+ def self.read_file: (untyped path) -> String
90
+ def self.safe_load_marshal: (untyped data) -> untyped
91
+ def self.git_present?: () -> bool
92
+ def self.gem_version: () -> Gem::Version
93
+ def self.verbose_version: () -> String
94
+ def self.self_manager: () -> untyped
95
+ def self.reset!: () -> void
96
+
97
+ # Top-level classes touched in real-world bundler / rubygems
98
+ # code paths the survey analysed. Each class declares only the
99
+ # most-used members; the rest fall through to `untyped`-typed
100
+ # singleton-class dispatch via the surrounding module's
101
+ # untyped return contracts.
102
+ class Definition
103
+ def self.build: (untyped gemfile, untyped lockfile, untyped unlock) -> Definition
104
+
105
+ def initialize: (*untyped) -> void
106
+ def gemfiles: () -> Array[Pathname]
107
+ def lockfile: () -> Pathname
108
+ def lockfile=: (untyped) -> untyped
109
+ def locked_gems: () -> LockfileParser
110
+ def dependencies: () -> Array[Dependency]
111
+ def current_dependencies: () -> Array[Dependency]
112
+ def requested_dependencies: () -> Array[Dependency]
113
+ def dependencies_for: (untyped groups) -> Array[Dependency]
114
+ def specs: () -> untyped
115
+ def specs_for: (untyped groups) -> untyped
116
+ def missing_specs: () -> untyped
117
+ def validate_runtime!: () -> untyped
118
+ def check!: () -> untyped
119
+ def lock: (?untyped) -> untyped
120
+ def write_lock: () -> untyped
121
+ def to_lock: () -> String
122
+ def resolve: () -> untyped
123
+ def resolve_with_cache!: () -> untyped
124
+ def resolve_remotely!: () -> untyped
125
+ def remotely!: () -> untyped
126
+ def ensure_equivalent_gemfile_and_lockfile: (?bool) -> untyped
127
+ def normalize_platforms: () -> untyped
128
+ def platforms: () -> Array[untyped]
129
+ def add_platform: (untyped) -> untyped
130
+ def remove_platform: (untyped) -> untyped
131
+ def add_checksums: () -> untyped
132
+ def groups: () -> Array[Symbol]
133
+ def ruby_version: () -> untyped
134
+ end
135
+
136
+ class LockfileParser
137
+ def initialize: (String body) -> void
138
+ def specs: () -> Array[LazySpecification]
139
+ def platforms: () -> Array[untyped]
140
+ def sources: () -> Array[untyped]
141
+ def dependencies: () -> Array[Dependency]
142
+ def ruby_version: () -> untyped
143
+ def bundler_version: () -> untyped
144
+ end
145
+
146
+ class LazySpecification
147
+ def name: () -> String
148
+ def version: () -> Gem::Version
149
+ def platform: () -> untyped
150
+ def dependencies: () -> Array[Gem::Dependency]
151
+ def source: () -> untyped
152
+ end
153
+
154
+ class Dependency < Gem::Dependency
155
+ attr_reader autorequire: Array[String]?
156
+ attr_reader source: untyped
157
+ attr_reader groups: Array[Symbol]
158
+ attr_reader platforms: Array[Symbol]
159
+ end
160
+
161
+ class ConfigFile
162
+ def []: (*untyped) -> untyped
163
+ def []=: (*untyped) -> untyped
164
+ def set_global: (untyped, untyped) -> untyped
165
+ def set_local: (untyped, untyped) -> untyped
166
+ def all: () -> Hash[String, untyped]
167
+ end
168
+
169
+ module Source
170
+ class Gemspec
171
+ def initialize: (*untyped) -> void
172
+ attr_accessor name: String?
173
+ attr_accessor version: String?
174
+ end
175
+
176
+ class Path
177
+ def initialize: (*untyped) -> void
178
+ attr_accessor name: String?
179
+ attr_accessor version: String?
180
+ attr_accessor path: String?
181
+ end
182
+
183
+ class Git
184
+ def initialize: (*untyped) -> void
185
+ attr_accessor uri: String?
186
+ attr_accessor branch: String?
187
+ attr_accessor ref: String?
188
+ attr_accessor submodules: bool
189
+ attr_accessor glob: String?
190
+ attr_accessor name: String?
191
+ attr_accessor version: String?
192
+ end
193
+
194
+ class Rubygems
195
+ def initialize: (*untyped) -> void
196
+ attr_accessor remotes: Array[String]
197
+ attr_accessor name: String?
198
+ attr_accessor version: String?
199
+ end
200
+ end
201
+
202
+ module UI
203
+ class Shell
204
+ def initialize: (?untyped) -> void
205
+ def info: (untyped, ?bool newline) -> void
206
+ def confirm: (untyped, ?bool newline) -> void
207
+ def warn: (untyped, ?bool newline) -> void
208
+ def debug: (untyped, ?bool newline) -> void
209
+ def debug?: () -> bool
210
+ def error: (untyped, ?bool newline) -> void
211
+ def trace: (untyped, ?untyped newline, ?bool force) -> void
212
+ def silence: () { () -> untyped } -> untyped
213
+ def ask: (untyped) -> String?
214
+ def yes?: (untyped) -> bool
215
+ def no?: () -> bool
216
+ def level: (?String name) -> String
217
+ def level=: (untyped) -> untyped
218
+ def quiet?: () -> bool
219
+ def quiet=: (bool) -> bool
220
+ end
221
+
222
+ class RGProxy
223
+ def initialize: (?untyped) -> void
224
+ end
225
+ end
226
+
227
+ class GemfileError < StandardError
228
+ end
229
+
230
+ class GemfileNotFound < StandardError
231
+ end
232
+
233
+ class LockfileError < StandardError
234
+ end
235
+
236
+ class GemNotFound < StandardError
237
+ end
238
+ end
@@ -0,0 +1,34 @@
1
+ #
2
+ # Rigor-side supplement to the rbs gem's
3
+ # `stdlib/cgi/0/core.rbs` declarations.
4
+ #
5
+ # Re-opens `class CGI` to bring in the instance methods that
6
+ # real-world Ruby code calls on a CGI instance: `params`,
7
+ # `params=`, `cookies`, `cookies=`, `multipart?`, `query_string`,
8
+ # the parsed-request bits.
9
+ #
10
+ # Why this isn't already in the upstream RBS: at runtime
11
+ # `CGI#initialize` does `extend CGI::QueryExtension`, which
12
+ # attaches the methods to each instance via singleton-class
13
+ # inheritance. The static-RBS surface can't represent
14
+ # per-instance `extend` calls. Declaring `class CGI; include
15
+ # CGI::QueryExtension; end` here is a deliberate
16
+ # over-approximation that matches the real surface every CGI
17
+ # instance you actually use (you got it from `CGI.new`) has.
18
+ #
19
+ # Driven by the tdiary-core survey
20
+ # (`docs/notes/20260519-oss-library-survey.md`) where
21
+ # `lib/tdiary/core_ext.rb:62`'s `cgi.params['key']` /
22
+ # `self.params[param]` surfaced as `undefined method 'params'
23
+ # for CGI` (3 errors per call site, 6 total).
24
+ #
25
+ # Adds new declarations only — never redeclares anything the
26
+ # upstream RBS already covers, so the loader does not raise
27
+ # `RBS::DuplicatedDeclarationError`. `include` is permitted
28
+ # because the upstream `class CGI` declaration already does
29
+ # `include CGI::Util` + `extend CGI::Util`; adding a sibling
30
+ # `include CGI::QueryExtension` is purely additive.
31
+ #
32
+ class CGI
33
+ include CGI::QueryExtension
34
+ end
@@ -0,0 +1,34 @@
1
+ #
2
+ # Rigor-side supplement to the rbs gem's
3
+ # `stdlib/did_you_mean/0/did_you_mean.rbs` declarations.
4
+ #
5
+ # Re-opens `module DidYouMean` to add the top-level singleton
6
+ # methods the upstream RBS omits — every method below is defined
7
+ # in `lib/did_you_mean.rb` and called by rubygems / bundler /
8
+ # optparse / thor without an RBS declaration to back it.
9
+ #
10
+ # Adds new declarations only; never redeclares anything the
11
+ # upstream RBS already covers, so the loader does not raise
12
+ # `RBS::DuplicatedDeclarationError`.
13
+ #
14
+ module DidYouMean
15
+ # Sharable hash of error-class names to spell-checker objects.
16
+ # Defaults to `Hash.new(NullChecker)` — the value's runtime
17
+ # default makes any missing-key lookup return `NullChecker`.
18
+ def self.spell_checkers: () -> Hash[String, untyped]
19
+
20
+ # `correct_error(error_class, spell_checker)` registers a
21
+ # spell-checker for the named error class, prepending
22
+ # `Correctable` to it when the class doesn't already include
23
+ # it. Returns the registered spell_checker (the assignment's
24
+ # value).
25
+ def self.correct_error: (untyped error_class, untyped spell_checker) -> untyped
26
+
27
+ # The active formatter. Returns the per-Ractor override when
28
+ # one is set; otherwise `DidYouMean::Formatter` (the module).
29
+ def self.formatter: () -> untyped
30
+
31
+ # Per-Ractor formatter override. Returns the assigned
32
+ # formatter under Ractor; nil otherwise.
33
+ def self.formatter=: (untyped) -> untyped
34
+ end
@@ -0,0 +1,54 @@
1
+ # Minimal hand-authored RBS stub for the `idn-ruby` gem
2
+ # (libidn binding for Internationalised Domain Names).
3
+ #
4
+ # `idn-ruby` is not in `ruby/gem_rbs_collection` as of 2026-05-15.
5
+ # Authorship: hand-written by Rigor maintainers based on the
6
+ # upstream README (https://github.com/idnruby/idn-ruby).
7
+
8
+ module IDN
9
+ VERSION: String
10
+
11
+ class Error < StandardError
12
+ end
13
+
14
+ class Stringprep
15
+ class StringprepError < IDN::Error
16
+ end
17
+
18
+ NAMEPREP: String
19
+ ISCSIPREP: String
20
+ NODEPREP: String
21
+ RESOURCEPREP: String
22
+ PLAIN: String
23
+ TRACE: String
24
+ SASLPREP: String
25
+
26
+ def self.with_profile: (String profile, String input) -> String
27
+ def self.nameprep: (String input) -> String
28
+ def self.iscsiprep: (String input) -> String
29
+ def self.nodeprep: (String input) -> String
30
+ def self.resourceprep: (String input) -> String
31
+ def self.plain: (String input) -> String
32
+ def self.trace: (String input) -> String
33
+ def self.saslprep: (String input) -> String
34
+ end
35
+
36
+ class Punycode
37
+ class PunycodeError < IDN::Error
38
+ end
39
+
40
+ def self.encode: (String input) -> String
41
+ def self.decode: (String input) -> String
42
+ end
43
+
44
+ class Idna
45
+ class IdnaError < IDN::Error
46
+ end
47
+
48
+ ALLOW_UNASSIGNED: Integer
49
+ USE_STD3_ASCII_RULES: Integer
50
+
51
+ def self.toASCII: (String input, ?Integer flags) -> String
52
+ def self.toUnicode: (String input, ?Integer flags) -> String
53
+ end
54
+ end
@@ -0,0 +1,55 @@
1
+ module Mysql2
2
+ class Client[ResultType]
3
+ MULTI_STATEMENTS: Integer
4
+
5
+ self.@default_query_options: untyped
6
+
7
+ @read_timeout: untyped
8
+
9
+ @query_options: untyped
10
+
11
+ attr_reader query_options: untyped
12
+
13
+ attr_reader read_timeout: untyped
14
+
15
+ def self.default_query_options: () -> untyped
16
+
17
+ def initialize: (Hash[(String | Symbol), untyped] opts) -> void
18
+
19
+ def self.new: (as: :hash, **untyped) -> Mysql2::Client[Mysql2::ResultAsHash]
20
+ | (as: :array, **untyped) -> Mysql2::Client[Mysql2::ResultAsArray]
21
+ | (as: Symbol, **untyped) -> Mysql2::Client[Mysql2::ResultAsHash | Mysql2::ResultAsArray]
22
+ | (**untyped) -> Mysql2::Client[Mysql2::ResultAsHash]
23
+
24
+ def parse_ssl_mode: (untyped mode) -> untyped
25
+
26
+ def parse_flags_array: (untyped flags, ?::Integer initial) -> untyped
27
+
28
+ # Find any default system CA paths to handle system roots
29
+ # by default if stricter validation is requested and no
30
+ # path is provide.
31
+ def find_default_ca_path: () -> untyped
32
+
33
+ # Set default program_name in performance_schema.session_connect_attrs
34
+ # and performance_schema.session_account_connect_attrs
35
+ def parse_connect_attrs: (untyped conn_attrs) -> (::Hash[untyped, untyped] | untyped)
36
+
37
+ def query: (String sql, as: :hash, **untyped) -> ResultAsHash
38
+ | (String sql, as: :array, **untyped) -> ResultAsArray
39
+ | (String sql, **untyped) -> ResultType
40
+
41
+ def query_info: () -> (::Hash[untyped, untyped] | untyped)
42
+
43
+ def info: () -> untyped
44
+
45
+ def last_id: () -> Integer
46
+
47
+ def affected_rows: () -> Integer
48
+
49
+ def prepare: (String sql) -> Mysql2::Statement
50
+
51
+ private
52
+
53
+ def self.local_offset: () -> untyped
54
+ end
55
+ end
@@ -0,0 +1,5 @@
1
+ module Mysql2
2
+ class Error < StandardError
3
+ attr_reader error_number: Integer
4
+ end
5
+ end
@@ -0,0 +1,31 @@
1
+ module Mysql2
2
+ type row_value_type = String | Integer | BigDecimal | Float | Time | Date | nil
3
+
4
+ class ResultAsHash
5
+ attr_reader server_flags: untyped
6
+
7
+ # NOTE:
8
+ # The type of key is controlled by `symbolize_keys` option of `Mysql2::Client.new`.
9
+ # It can be expressed using a type argument such as `Client[ResultType]`,
10
+ # but since the state becomes complicated. So `String | Symbol` is allowed.
11
+ type key_type = String | Symbol
12
+
13
+ include Enumerable[Hash[key_type, row_value_type]]
14
+
15
+ def each: () { (Hash[key_type, row_value_type]) -> void } -> void
16
+ def count: () -> Integer
17
+ def to_a: () -> Array[untyped]
18
+ alias size count
19
+ end
20
+
21
+ class ResultAsArray
22
+ attr_reader server_flags: untyped
23
+
24
+ include Enumerable[Array[row_value_type]]
25
+
26
+ def each: () { (Array[row_value_type]) -> void } -> void
27
+ def count: () -> Integer
28
+ def to_a: () -> Array[untyped]
29
+ alias size count
30
+ end
31
+ end
@@ -0,0 +1,5 @@
1
+ module Mysql2
2
+ class Statement
3
+ def execute: (*untyped, **untyped) -> (Mysql2::ResultAsHash | Mysql2::ResultAsArray)
4
+ end
5
+ end