class RBI::Rewriters::NestSingletonMethods
Public Instance Methods
visit(node)
click to toggle source
# File lib/rbi/rewriters/nest_singleton_methods.rb, line 10 def visit(node) return unless node case node when Tree singleton_class = SingletonClass.new node.nodes.dup.each do |child| visit(child) next unless child.is_a?(Method) && child.is_singleton child.detach child.is_singleton = false singleton_class << child end node << singleton_class unless singleton_class.empty? end end