17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/rucoa/rbs/ruby_definitions_loader.rb', line 17
def call
declarations.flat_map do |declaration|
case declaration
when ::RBS::AST::Declarations::Constant
[ConstantDefinitionMapper.call(declaration: declaration)]
when ::RBS::AST::Declarations::Class
[ClassDefinitionMapper.call(declaration: declaration)] +
declaration.members.grep(::RBS::AST::Members::MethodDefinition).map do |method_definition|
MethodDefinitionMapper.call(
declaration: declaration,
method_definition: method_definition
)
end
when ::RBS::AST::Declarations::Module
[ModuleDefinitionMapper.call(declaration: declaration)] +
declaration.members.grep(::RBS::AST::Members::MethodDefinition).map do |method_definition|
MethodDefinitionMapper.call(
declaration: declaration,
method_definition: method_definition
)
end
else
[]
end
end
end
|