lib/rbi/rewriters/remove_known_definitions.rb in rbi-0.0.16 vs lib/rbi/rewriters/remove_known_definitions.rb in rbi-0.0.17

- old
+ new

@@ -46,29 +46,33 @@ # OPERATIONS # ~~~ class RemoveKnownDefinitions < Visitor extend T::Sig - sig do - params( - tree: Tree, - index: Index - ).returns([Tree, T::Array[Operation]]) - end - def self.remove(tree, index) - v = RemoveKnownDefinitions.new(index) - v.visit(tree) - [tree, v.operations] - end - sig { returns(T::Array[Operation]) } attr_reader :operations sig { params(index: Index).void } def initialize(index) super() @index = index @operations = T.let([], T::Array[Operation]) + end + + class << self + extend T::Sig + + sig do + params( + tree: Tree, + index: Index, + ).returns([Tree, T::Array[Operation]]) + end + def remove(tree, index) + v = RemoveKnownDefinitions.new(index) + v.visit(tree) + [tree, v.operations] + end end sig { params(nodes: T::Array[Node]).void } def visit_all(nodes) nodes.dup.each { |node| visit(node) }