Module: RBS::Dynamic
- Defined in:
- lib/rbs/dynamic.rb,
lib/rbs/dynamic/cli.rb,
lib/rbs/dynamic/config.rb,
lib/rbs/dynamic/tracer.rb,
lib/rbs/dynamic/builder.rb,
lib/rbs/dynamic/version.rb,
lib/rbs/dynamic/builder/types.rb,
lib/rbs/dynamic/builder/methods.rb,
lib/rbs/dynamic/refine/trace_point.rb,
lib/rbs/dynamic/tracer/called_method.rb,
lib/rbs/dynamic/converter/trace_to_rbs.rb,
lib/rbs/dynamic/refine/signature_merger.rb,
lib/rbs/dynamic/refine/each_called_method.rb,
lib/rbs/dynamic/refine/basic_object_with_kernel.rb,
lib/rbs/dynamic/converter/called_method_to_sigunature.rb,
lib/rbs/dynamic/converter/called_method_to_with_interface.rb
Defined Under Namespace
Modules: Builder, Converter, Refine, Tracer
Classes: CLI, Config
Constant Summary
collapse
- VERSION =
"0.1.0"
Class Method Summary
collapse
Class Method Details
.trace(**options, &block) ⇒ Object
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/rbs/dynamic.rb', line 11
def self.trace(**options, &block)
config = Config.new(options)
tmp_stdout= $stdout
$stdout = StringIO.new unless config.stdout?
called_methods = RBS::Dynamic::Tracer.trace(
target_filepath_pattern: config.target_filepath_pattern,
ignore_filepath_pattern: config.ignore_filepath_pattern,
trace_c_api_method: config.trace_c_api_method?,
&block
)
Converter::TraceToRBS.new(called_methods).convert(
root_path: config.root_path,
except_build_members: config.except_build_members,
method_defined_calssses: config.method_defined_calssses,
include_method_location: config.show_method_location?,
use_literal_type: config.use_literal_type?,
with_literal_type: config.with_literal_type?,
use_interface_method_argument: config.use_interface_method_argument?,
target_classname_pattern: config.target_classname_pattern,
ignore_classname_pattern: config.ignore_classname_pattern
)
ensure
$stdout = tmp_stdout
end
|
.trace_to_rbs_text(**options, &block) ⇒ Object
40
41
42
43
44
45
46
47
|
# File 'lib/rbs/dynamic.rb', line 40
def self.trace_to_rbs_text(**options, &block)
result = RBS::Dynamic.trace(**{ stdout: true }.merge(**options), &block)
decls = result.values
stdout = StringIO.new
writer = RBS::Writer.new(out: stdout)
writer.write(decls)
stdout.string
end
|