Class: Spoom::Sorbet::Sigs::SigsLocator
- Inherits:
-
RBI::Visitor
- Object
- RBI::Visitor
- Spoom::Sorbet::Sigs::SigsLocator
- Defined in:
- lib/spoom/sorbet/sigs.rb
Instance Attribute Summary collapse
-
#rbs_comments ⇒ Object
readonly
: Array[[RBI::RBSComment, (RBI::Method | RBI::Attr)]].
-
#sigs ⇒ Object
readonly
: Array[[RBI::Sig, (RBI::Method | RBI::Attr)]].
Instance Method Summary collapse
-
#initialize ⇒ SigsLocator
constructor
: -> void.
-
#visit(node) ⇒ Object
: (RBI::Node? node) -> void.
Constructor Details
#initialize ⇒ SigsLocator
: -> void
96 97 98 99 100 |
# File 'lib/spoom/sorbet/sigs.rb', line 96 def initialize super @sigs = T.let([], T::Array[[RBI::Sig, T.any(RBI::Method, RBI::Attr)]]) @rbs_comments = T.let([], T::Array[[RBI::RBSComment, T.any(RBI::Method, RBI::Attr)]]) end |
Instance Attribute Details
#rbs_comments ⇒ Object (readonly)
: Array[[RBI::RBSComment, (RBI::Method | RBI::Attr)]]
93 94 95 |
# File 'lib/spoom/sorbet/sigs.rb', line 93 def rbs_comments @rbs_comments end |
#sigs ⇒ Object (readonly)
: Array[[RBI::Sig, (RBI::Method | RBI::Attr)]]
90 91 92 |
# File 'lib/spoom/sorbet/sigs.rb', line 90 def sigs @sigs end |
Instance Method Details
#visit(node) ⇒ Object
: (RBI::Node? node) -> void
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/spoom/sorbet/sigs.rb', line 104 def visit(node) return unless node case node when RBI::Method, RBI::Attr node.sigs.each do |sig| next if sig.is_abstract @sigs << [sig, node] end node.comments.grep(RBI::RBSComment).each do |rbs_comment| @rbs_comments << [rbs_comment, node] end when RBI::Tree visit_all(node.nodes) end end |