15
16
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
|
# File 'lib/rbs_active_hash/active_hash/parser.rb', line 15
def process(node, decls:, comments:, context:)
case node.type
when :FCALL, :VCALL
case node.children.first
when :has_many, :has_one, :belongs_to
decls << AssociationDefinition.new(
name: RBS::TypeName.new(name: node.children.first, namespace: RBS::Namespace.root),
args: node.children[1],
annotations: [],
location: nil,
comment: nil
)
when :scope
decls << ScopeDefinition.new(
name: RBS::TypeName.new(name: node.children.first, namespace: RBS::Namespace.root),
args: node.children[1],
annotations: [],
location: nil,
comment: nil
)
else
super
end
else
super
end
end
|