Class: Spoom::Sorbet::Translate::RBSCommentsToSorbetSigs::Options
- Inherits:
-
Object
- Object
- Spoom::Sorbet::Translate::RBSCommentsToSorbetSigs::Options
- Defined in:
- lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs/options.rb
Constant Summary collapse
- ALLOWED_OVERLOAD_STRATEGIES =
[:translate_all, :translate_last, :raise].freeze
Class Attribute Summary collapse
-
.default ⇒ Object
readonly
: Options.
Instance Attribute Summary collapse
-
#erase_generic_types ⇒ Object
readonly
: bool.
-
#output_format ⇒ Object
readonly
: BaseRBIFormat.
-
#overloads_strategy ⇒ Object
readonly
: Symbol.
-
#rbi_options ⇒ Object
readonly
: RBI::RBS::MethodTypeTranslator::Options.
-
#translate_abstract_methods ⇒ Object
readonly
: bool.
Instance Method Summary collapse
-
#initialize(overloads_strategy: :translate_all, erase_generic_types: false, output_format: HumanReadableRBIFormat.default, translate_abstract_methods: true) ⇒ Options
constructor
: ( | ?overloads_strategy: Symbol, | ?erase_generic_types: bool, | ?output_format: BaseRBIFormat, | ?translate_abstract_methods: bool, | ) -> void.
Constructor Details
#initialize(overloads_strategy: :translate_all, erase_generic_types: false, output_format: HumanReadableRBIFormat.default, translate_abstract_methods: true) ⇒ Options
: ( | ?overloads_strategy: Symbol, | ?erase_generic_types: bool, | ?output_format: BaseRBIFormat, | ?translate_abstract_methods: bool, | ) -> void
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs/options.rb', line 65 def initialize( overloads_strategy: :translate_all, erase_generic_types: false, output_format: HumanReadableRBIFormat.default, translate_abstract_methods: true ) unless ALLOWED_OVERLOAD_STRATEGIES.include?(overloads_strategy) raise ArgumentError, "Unknown overloads_strategy: #{overloads_strategy.inspect}. " \ "Must be one of: #{ALLOWED_OVERLOAD_STRATEGIES.map(&:inspect).join(", ")}" end @overloads_strategy = overloads_strategy @erase_generic_types = erase_generic_types @rbi_options = RBI::RBS::MethodTypeTranslator::Options.new(erase_generic_types:) #: RBI::RBS::MethodTypeTranslator::Options @output_format = output_format @translate_abstract_methods = translate_abstract_methods freeze end |
Class Attribute Details
.default ⇒ Object (readonly)
: Options
88 89 90 |
# File 'lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs/options.rb', line 88 def default @default end |
Instance Attribute Details
#erase_generic_types ⇒ Object (readonly)
: bool
48 49 50 |
# File 'lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs/options.rb', line 48 def erase_generic_types @erase_generic_types end |
#output_format ⇒ Object (readonly)
: BaseRBIFormat
54 55 56 |
# File 'lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs/options.rb', line 54 def output_format @output_format end |
#overloads_strategy ⇒ Object (readonly)
: Symbol
43 44 45 |
# File 'lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs/options.rb', line 43 def overloads_strategy @overloads_strategy end |
#rbi_options ⇒ Object (readonly)
: RBI::RBS::MethodTypeTranslator::Options
51 52 53 |
# File 'lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs/options.rb', line 51 def @rbi_options end |
#translate_abstract_methods ⇒ Object (readonly)
: bool
57 58 59 |
# File 'lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs/options.rb', line 57 def translate_abstract_methods @translate_abstract_methods end |