File: visibility_checking.rb

package info (click to toggle)
ruby-sequel 5.63.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 10,408 kB
  • sloc: ruby: 113,747; makefile: 3
file content (21 lines) | stat: -rw-r--r-- 612 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
require 'visibility_checker'
changes = VISIBILITY_CHANGES = []
Minitest.after_run do
  if defined?(DB)
    [DB.singleton_class, DB.dataset.singleton_class].each do |c|
      VISIBILITY_CHANGES.concat(VisibilityChecker.visibility_changes(c).map{|v| [v, c.inspect]})
    end
  end

  changes.uniq!{|v,| v}
  changes.map! do |v, caller|
    "#{caller}: #{v.new_visibility} method #{v.overridden_by}##{v.method} overrides #{v.original_visibility} method in #{v.defined_in}"
  end
  changes.sort!
  if changes.empty?
    puts "No visibility changes"
  else
    puts "Visibility changes:"
    puts(*changes)
  end
end