Class: Rbs2ts::Cli

Inherits:
Thor
  • Object
show all
Defined in:
lib/rbs2ts/cli.rb

Instance Method Summary collapse

Instance Method Details

#convert(path) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/rbs2ts/cli.rb', line 7

def convert(path)
  ::RBS.logger_level = :error

  loader = ::RBS::EnvironmentLoader.new(core_root: nil)

  loader.add(path: Pathname(path))

  env = ::RBS::Environment.from_loader(loader).resolve_type_names

  puts Converter::Declarations::Declarations.new(env.declarations).to_ts
end