Module: Tapioca::Helpers::Test::DslCompiler

Extended by:
T::Sig
Includes:
Content, Isolation, Template
Defined in:
lib/tapioca/helpers/test/dsl_compiler.rb

Overview

@requires_ancestor: Kernel

Defined Under Namespace

Classes: CompilerContext

Constant Summary

Constants included from Template

Template::ERB_SUPPORTS_KVARGS

Constants included from Isolation::Subprocess

Isolation::Subprocess::ORIG_ARGV

Instance Method Summary collapse

Methods included from Template

#indented, #rails_version, #ruby_version, #template

Methods included from Content

#add_content_file, #add_ruby_file, #remove_tmp_path, #teardown, #tmp_path

Methods included from Isolation

forking_env?, #run

Methods included from Isolation::Subprocess

#run_in_isolation

Methods included from Isolation::Forking

#run_in_isolation

Instance Method Details

#activate_other_dsl_compilers(*compiler_classes) ⇒ Object

: (*singleton(Tapioca::Dsl::Compiler) compiler_classes) -> void



26
27
28
# File 'lib/tapioca/helpers/test/dsl_compiler.rb', line 26

def activate_other_dsl_compilers(*compiler_classes)
  context.activate_other_dsl_compilers(compiler_classes)
end

#contextObject

: -> CompilerContext



46
47
48
49
50
# File 'lib/tapioca/helpers/test/dsl_compiler.rb', line 46

def context
  raise "Please call `use_dsl_compiler` before" unless @context

  @context
end

#gathered_constantsObject

: -> Array



36
37
38
# File 'lib/tapioca/helpers/test/dsl_compiler.rb', line 36

def gathered_constants
  context.gathered_constants
end

#generated_errorsObject

: -> Array



41
42
43
# File 'lib/tapioca/helpers/test/dsl_compiler.rb', line 41

def generated_errors
  context.errors
end

#rbi_for(constant_name, compiler_options: {}) ⇒ Object

: ((Symbol | String) constant_name, ?compiler_options: Hash[Symbol, untyped]) -> String



31
32
33
# File 'lib/tapioca/helpers/test/dsl_compiler.rb', line 31

def rbi_for(constant_name, compiler_options: {})
  context.rbi_for(constant_name, compiler_options: compiler_options)
end

#use_dsl_compiler(compiler_class) ⇒ Object

: (singleton(Tapioca::Dsl::Compiler) compiler_class) -> void



21
22
23
# File 'lib/tapioca/helpers/test/dsl_compiler.rb', line 21

def use_dsl_compiler(compiler_class)
  @context = CompilerContext.new(compiler_class) #: CompilerContext?
end