Skip to content

Commit 6cc1127

Browse files
feat: prevent tapioca from introspecting the gem internals (#56)
1 parent b041ad1 commit 6cc1127

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,8 @@ openai.chat.completions.create(
166166

167167
## Sorbet Support
168168

169+
**This library emits an intentional warning under the [`tapioca` toolchain](https://github.com/Shopify/tapioca)**. This is normal, and does not impact functionality.
170+
169171
This library is written with [Sorbet type definitions](https://sorbet.org/docs/rbi). However, there is no runtime dependency on the `sorbet-runtime`.
170172

171173
What this means is that while you can use Sorbet to type check your code statically, and benefit from the [Sorbet Language Server](https://sorbet.org/docs/lsp) in your editor, there is no runtime type checking and execution overhead from Sorbet itself.

lib/openai.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
# frozen_string_literal: true
22

3+
# We already ship the preferred sorbet manifests in the package itself.
4+
# `tapioca` currently does not offer us a way to opt out of unnecessary compilation.
5+
if defined?(:Tapioca) && caller_locations.any? { _1.path.end_with?("tapioca/cli.rb") }
6+
Warning.warn(
7+
<<~WARN
8+
\n
9+
⚠️ skipped loading of "openai" gem under `tapioca`.
10+
11+
This message is normal and expected if you are running a `tapioca` command, and does not impact `.rbi` generation.
12+
\n
13+
WARN
14+
)
15+
return
16+
end
17+
318
# Standard libraries.
419
require "cgi"
520
require "date"

0 commit comments

Comments
 (0)