Class: DataWorks::StaleRelationshipChecker

Inherits:
Object
  • Object
show all
Defined in:
lib/data_works/stale_relationship_checker.rb

Class Method Summary collapse

Class Method Details

.check!Object



5
6
7
8
9
10
11
# File 'lib/data_works/stale_relationship_checker.rb', line 5

def check!
  if snapshot_exists?
    check_for_staleness!
  else
    create_snapshot!
  end
end

.create_snapshot!Object



13
14
15
16
17
18
19
20
21
22
# File 'lib/data_works/stale_relationship_checker.rb', line 13

def create_snapshot!
  File.open(filepath, 'w') do |f|
    f.puts explanatory_comments
    f.puts "DataWorks::MOST_RECENT_SNAPSHOT = ["
    current_snapshot.each do |class_name, belongs_to_name|
      f.puts "  ['#{class_name}', #{belongs_to_name}],"
    end
    f.puts "]"
  end
end