Class: Gametime::Helper::VerifyObservers

Inherits:
Object
  • Object
show all
Defined in:
lib/gametime/helper/observer.rb

Instance Method Summary collapse

Instance Method Details

#verifyObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/gametime/helper/observer.rb', line 4

def verify
  puts 'Verifying all observers are deinit on the view'.colorize(:blue)

  valid_event = true
  files_with_observers = `grep 'addObserver' -R Classes/ -l`.split("\n")
  files_with_observers.each do |file|
    search_results = `grep removeObserver "#{file}"`

    if search_results == ""
      valid_event = false
      puts "missing remove #{file}".colorize(:red)
    end
  end

  valid_event ? (puts 'All Good'.colorize(:green)) : (puts 'Errors Occured'.colorize(:red))
end