Class: Spoom::Cli::Srb::Assertions

Inherits:
Thor
  • Object
show all
Includes:
Helper
Defined in:
lib/spoom/cli/srb/assertions.rb

Constant Summary

Constants included from Helper

Helper::HIGHLIGHT_COLOR

Instance Method Summary collapse

Methods included from Helper

#blue, #collect_files, #color?, #colorize, #context, #context_requiring_sorbet!, #cyan, #exec_path, #gray, #green, #highlight, #red, #say, #say_error, #say_warning, #yellow

Methods included from Spoom::Colorize

#set_color

Instance Method Details

#translate(*paths) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/spoom/cli/srb/assertions.rb', line 13

def translate(*paths)
  from = options[:from]
  to = options[:to]
  files = collect_files(paths)

  say("Translating type assertions from `#{from}` to `#{to}` " \
    "in `#{files.size}` file#{files.size == 1 ? "" : "s"}...\n\n")

  transformed_files = transform_files(files) do |file, contents|
    Spoom::Sorbet::Assertions.rbi_to_rbs(contents, file: file)
  end

  say("Translated type assertions in `#{transformed_files}` file#{transformed_files == 1 ? "" : "s"}.")
end