Created
June 24, 2024 18:59
-
-
Save tompng/8223cf5c3fa880815cf04974a14e720c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rbs' | |
require 'rbs/cli' | |
loader = RBS::CLI::LibraryOptions.new.loader | |
def loader.each_dir | |
@loaded_dirs ||= Set.new | |
super do |source, dir| | |
next if @loaded_dirs.include? dir | |
@loaded_dirs << dir | |
yield source, dir | |
end | |
end | |
env = RBS::Environment.from_loader(loader).resolve_type_names | |
rbs_builder = RBS::DefinitionBuilder.new(env:) | |
loader.add(library: 'prism', version: '0.30.0') | |
env_diff = RBS::Environment.from_loader(loader).resolve_type_names | |
env_diff.signatures.each do |buffer, (directives, decls)| | |
env.add_signature(buffer:, directives:, decls:) | |
end | |
rbs_builder2 = RBS::DefinitionBuilder.new(env:) | |
rbs_builder2.build_singleton RBS::TypeName('Prism').absolute! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment