Class: Spoom::Cli::Srb::Sigs
- Inherits:
-
Thor
- Object
- Thor
- Spoom::Cli::Srb::Sigs
show all
- Extended by:
- T::Sig
- Includes:
- Helper
- Defined in:
- lib/spoom/cli/srb/sigs.rb
Constant Summary
Constants included
from Helper
Helper::HIGHLIGHT_COLOR
Instance Method Summary
collapse
Methods included from Helper
#blue, #color?, #colorize, #context, #context_requiring_sorbet!, #cyan, #exec_path, #gray, #green, #highlight, #red, #say, #say_error, #say_warning, #yellow
#set_color
Instance Method Details
#strip(*paths) ⇒ Object
32
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/spoom/cli/srb/sigs.rb', line 32
def strip(*paths)
files = collect_files(paths)
say("Stripping signatures from `#{files.size}` file#{files.size == 1 ? "" : "s"}...\n\n")
transformed_files = transform_files(files) do |_file, contents|
Spoom::Sorbet::Sigs.strip(contents)
end
say("Stripped signatures from `#{transformed_files}` file#{transformed_files == 1 ? "" : "s"}.")
end
|
#translate(*paths) ⇒ Object
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/spoom/cli/srb/sigs.rb', line 16
def translate(*paths)
from = options[:from]
to = options[:to]
files = collect_files(paths)
say("Translating signatures from `#{from}` to `#{to}` " \
"in `#{files.size}` file#{files.size == 1 ? "" : "s"}...\n\n")
transformed_files = transform_files(files) do |_file, contents|
Spoom::Sorbet::Sigs.rbi_to_rbs(contents)
end
say("Translated signatures in `#{transformed_files}` file#{transformed_files == 1 ? "" : "s"}.")
end
|