Class: Spoom::Sorbet::Sigs::SigsLocator

Inherits:
RBI::Visitor
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/spoom/sorbet/sigs.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeSigsLocator

Returns a new instance of SigsLocator.



63
64
65
66
# File 'lib/spoom/sorbet/sigs.rb', line 63

def initialize
  super
  @sigs = T.let([], T::Array[[RBI::Sig, T.any(RBI::Method, RBI::Attr)]])
end

Instance Attribute Details

#sigsObject (readonly)

Returns the value of attribute sigs.



60
61
62
# File 'lib/spoom/sorbet/sigs.rb', line 60

def sigs
  @sigs
end

Instance Method Details

#visit(node) ⇒ Object



69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/spoom/sorbet/sigs.rb', line 69

def visit(node)
  return unless node

  case node
  when RBI::Method, RBI::Attr
    node.sigs.each do |sig|
      @sigs << [sig, node]
    end
  when RBI::Tree
    visit_all(node.nodes)
  end
end