lib/tapioca/helpers/test/dsl_compiler.rb in tapioca-0.14.3 vs lib/tapioca/helpers/test/dsl_compiler.rb in tapioca-0.14.4
- old
+ new
@@ -27,14 +27,19 @@
sig { params(compiler_classes: T.class_of(Tapioca::Dsl::Compiler)).void }
def activate_other_dsl_compilers(*compiler_classes)
context.activate_other_dsl_compilers(compiler_classes)
end
- sig { params(constant_name: T.any(Symbol, String)).returns(String) }
- def rbi_for(constant_name)
- context.rbi_for(constant_name)
+ sig do
+ params(
+ constant_name: T.any(Symbol, String),
+ compiler_options: T::Hash[Symbol, T.untyped],
+ ).returns(String)
end
+ def rbi_for(constant_name, compiler_options: {})
+ context.rbi_for(constant_name, compiler_options: compiler_options)
+ end
sig { returns(T::Array[String]) }
def gathered_constants
context.gathered_constants
end
@@ -83,20 +88,25 @@
sig { returns(T::Array[String]) }
def gathered_constants
compiler_class.processable_constants.filter_map(&:name).sort
end
- sig { params(constant_name: T.any(Symbol, String)).returns(String) }
- def rbi_for(constant_name)
+ sig do
+ params(
+ constant_name: T.any(Symbol, String),
+ compiler_options: T::Hash[Symbol, T.untyped],
+ ).returns(String)
+ end
+ def rbi_for(constant_name, compiler_options: {})
# Make sure this is a constant that we can handle.
unless gathered_constants.include?(constant_name.to_s)
raise "`#{constant_name}` is not processable by the `#{compiler_class}` compiler."
end
file = RBI::File.new(strictness: "strong")
constant = Object.const_get(constant_name)
- compiler = compiler_class.new(pipeline, file.root, constant)
+ compiler = compiler_class.new(pipeline, file.root, constant, compiler_options.transform_keys(&:to_s))
compiler.decorate
rbi = Tapioca::DEFAULT_RBI_FORMATTER.print_file(file)
result = sorbet(
"--no-config",