Module: Yard2rbs
- Defined in:
- lib/yard2rbs/converter.rb,
lib/yard2rbs.rb,
lib/yard2rbs/version.rb,
lib/yard2rbs/yard_parser.rb
Overview
TODO:
-
Convert YARD “Boolean” to RBS “bool”
- Make some classes top level via
-
(e.g. String -> ::String)
Defined Under Namespace
Classes: Converter, YardParser
Constant Summary collapse
- VERSION =
"0.0.3"
Class Method Summary collapse
Class Method Details
.convert(file_paths) ⇒ Boolean
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/yard2rbs.rb', line 11 def convert(file_paths) file_paths.each do |file_path| output = Converter.convert(file_path) next if output.empty? input_dirname = File.dirname(file_path) input_filename = File.basename(file_path, ".*") output_dirname = File.join("sig", input_dirname) output_filename = "#{input_filename}.rbs" output_path = File.join(output_dirname, output_filename) FileUtils.mkdir_p(output_dirname) File.open(output_path, 'w+') do |file| file.puts(output) end end true end |