Module: Spoom::Sorbet::Translate::RBSCommentsToSorbetSigs
- Defined in:
- lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs.rb,
lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs/options.rb,
lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs/base_translator.rb,
lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs/line_matching_translator.rb,
lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs/human_readable_translator.rb
Defined Under Namespace
Classes: BaseRBIFormat, BaseTranslator, HumanReadableRBIFormat, HumanReadableTranslator, LineMatchedRBIFormat, LineMatchingTranslator, Options
Class Method Summary collapse
-
.rewrite_if_needed(ruby_contents, file:, max_line_length: nil, overloads_strategy: :translate_all, erase_generic_types: false, force: false) ⇒ Object
: ( | String ruby_contents, | file: String, | ?max_line_length: Integer?, | ?overloads_strategy: Symbol, | ?erase_generic_types: bool, | ?force: bool) -> String.
Class Method Details
.rewrite_if_needed(ruby_contents, file:, max_line_length: nil, overloads_strategy: :translate_all, erase_generic_types: false, force: false) ⇒ Object
: ( | String ruby_contents, | file: String, | ?max_line_length: Integer?, | ?overloads_strategy: Symbol, | ?erase_generic_types: bool, | ?force: bool) -> String
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs.rb', line 29 def rewrite_if_needed( ruby_contents, file:, max_line_length: nil, overloads_strategy: :translate_all, erase_generic_types: false, force: false ) return ruby_contents unless ruby_contents.match?(RBS_REWRITE_PATTERN) && (force || Sigils.contains_valid_sigil?(ruby_contents)) = Options.new( overloads_strategy:, erase_generic_types:, output_format: HumanReadableRBIFormat.new( max_line_length:, ), ) HumanReadableTranslator.new(ruby_contents, file:, options:).rewrite end |