Class: Sord::TypeConverter::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/sord/type_converter.rb

Overview

Configuration for how the type converter should work in particular cases.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(replace_errors_with_untyped:, replace_unresolved_with_untyped:, output_language:) ⇒ Configuration

Returns a new instance of Configuration.



100
101
102
103
104
# File 'lib/sord/type_converter.rb', line 100

def initialize(replace_errors_with_untyped:, replace_unresolved_with_untyped:, output_language:)
  @output_language = output_language
  @replace_errors_with_untyped = replace_errors_with_untyped
  @replace_unresolved_with_untyped = replace_unresolved_with_untyped
end

Instance Attribute Details

#output_languageObject

The language which the generated types will be converted to - one of ‘:rbi` or `:rbs`.



108
109
110
# File 'lib/sord/type_converter.rb', line 108

def output_language
  @output_language
end

#replace_errors_with_untypedBoolean

Returns If true, T.untyped is used instead of SORD_ERROR_ constants for unknown types.

Returns:

  • (Boolean)

    If true, T.untyped is used instead of SORD_ERROR_ constants for unknown types.



112
113
114
# File 'lib/sord/type_converter.rb', line 112

def replace_errors_with_untyped
  @replace_errors_with_untyped
end

#replace_unresolved_with_untypedObject

Parameters:

  • replace_unresolved_with_untyped (Boolean)

    If true, T.untyped is used when Sord is unable to resolve a constant.



116
117
118
# File 'lib/sord/type_converter.rb', line 116

def replace_unresolved_with_untyped
  @replace_unresolved_with_untyped
end