Class: RBI::Visitor

Inherits:
Object
  • Object
show all
Extended by:
T::Helpers, T::Sig
Defined in:
lib/rbi/visitor.rb

Instance Method Summary collapse

Instance Method Details

#visit(node) ⇒ Object



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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/rbi/visitor.rb', line 14

def visit(node)
  return unless node

  case node
  when BlankLine
    visit_blank_line(node)
  when Comment
    visit_comment(node)
  when TEnum
    visit_tenum(node)
  when TStruct
    visit_tstruct(node)
  when Module
    visit_module(node)
  when Class
    visit_class(node)
  when SingletonClass
    visit_singleton_class(node)
  when Struct
    visit_struct(node)
  when Group
    visit_group(node)
  when VisibilityGroup
    visit_visibility_group(node)
  when ConflictTree
    visit_conflict_tree(node)
  when ScopeConflict
    visit_scope_conflict(node)
  when TEnumBlock
    visit_tenum_block(node)
  when Tree
    visit_tree(node)
  when Const
    visit_const(node)
  when AttrAccessor
    visit_attr_accessor(node)
  when AttrReader
    visit_attr_reader(node)
  when AttrWriter
    visit_attr_writer(node)
  when Method
    visit_method(node)
  when ReqParam
    visit_req_param(node)
  when OptParam
    visit_opt_param(node)
  when RestParam
    visit_rest_param(node)
  when KwParam
    visit_kw_param(node)
  when KwOptParam
    visit_kw_opt_param(node)
  when KwRestParam
    visit_kw_rest_param(node)
  when BlockParam
    visit_block_param(node)
  when Include
    visit_include(node)
  when Extend
    visit_extend(node)
  when Public
    visit_public(node)
  when Protected
    visit_protected(node)
  when Private
    visit_private(node)
  when Send
    visit_send(node)
  when KwArg
    visit_kw_arg(node)
  when Arg
    visit_arg(node)
  when Sig
    visit_sig(node)
  when SigParam
    visit_sig_param(node)
  when TStructConst
    visit_tstruct_const(node)
  when TStructProp
    visit_tstruct_prop(node)
  when Helper
    visit_helper(node)
  when TypeMember
    visit_type_member(node)
  when MixesInClassMethods
    visit_mixes_in_class_methods(node)
  when RequiresAncestor
    visit_requires_ancestor(node)
  else
    raise VisitorError, "Unhandled node: #{node.class}"
  end
end

#visit_all(nodes) ⇒ Object



108
109
110
# File 'lib/rbi/visitor.rb', line 108

def visit_all(nodes)
  nodes.each { |node| visit(node) }
end

#visit_file(file) ⇒ Object



113
114
115
# File 'lib/rbi/visitor.rb', line 113

def visit_file(file)
  visit(file.root)
end