Class: CabezaDeTermo::AssetsPublisher::ClockCardMachine

Inherits:
Object
  • Object
show all
Defined in:
lib/cabeza-de-termo/assets-publisher/clock-cards/clock-card-machine.rb

Overview

An object to detect if a compilation job needs to run or not.

Instance Method Summary collapse

Constructor Details

#initializeClockCardMachine



5
6
7
# File 'lib/cabeza-de-termo/assets-publisher/clock-cards/clock-card-machine.rb', line 5

def initialize()
  @clock_cards = {}
end

Instance Method Details

#is_outdated?(compilation_job) ⇒ Boolean



9
10
11
12
13
# File 'lib/cabeza-de-termo/assets-publisher/clock-cards/clock-card-machine.rb', line 9

def is_outdated?(compilation_job)
  return true unless has_record_on?(compilation_job.id)

  clock_cards_not_match? clock_cards[compilation_job.id], compilation_job.clock_card
end

#register_modifications_on(compilation_job) ⇒ Object



15
16
17
18
19
20
# File 'lib/cabeza-de-termo/assets-publisher/clock-cards/clock-card-machine.rb', line 15

def register_modifications_on(compilation_job)
  clock_cards.delete(compilation_job.id)

  CdT.object compilation_job.clock_card,
    if_not_nil: proc { |card| clock_cards[compilation_job.id] = card unless card.has_assets_missing? }
end