Class: Siding::Staleness::Verdict

Inherits:
Struct
  • Object
show all
Defined in:
lib/siding/staleness.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#reasonsObject

Returns the value of attribute reasons

Returns:

  • (Object)

    the current value of reasons



21
22
23
# File 'lib/siding/staleness.rb', line 21

def reasons
  @reasons
end

#revision_labelObject

Returns the value of attribute revision_label

Returns:

  • (Object)

    the current value of revision_label



21
22
23
# File 'lib/siding/staleness.rb', line 21

def revision_label
  @revision_label
end

#strategyObject

Returns the value of attribute strategy

Returns:

  • (Object)

    the current value of strategy



21
22
23
# File 'lib/siding/staleness.rb', line 21

def strategy
  @strategy
end

#trigger_pathsObject

Returns the value of attribute trigger_paths

Returns:

  • (Object)

    the current value of trigger_paths



21
22
23
# File 'lib/siding/staleness.rb', line 21

def trigger_paths
  @trigger_paths
end

Instance Method Details

#fresh?Boolean

Returns:

  • (Boolean)


22
# File 'lib/siding/staleness.rb', line 22

def fresh? = strategy == FRESH

#reboot?Boolean

Returns:

  • (Boolean)


25
# File 'lib/siding/staleness.rb', line 25

def reboot? = strategy == REBOOT

#reloadable?Boolean

Returns:

  • (Boolean)


24
# File 'lib/siding/staleness.rb', line 24

def reloadable? = strategy == RELOADABLE

#resolutionObject



27
28
29
30
31
32
33
# File 'lib/siding/staleness.rb', line 27

def resolution
  case strategy
  when FRESH then "fresh"
  when RELOADABLE then "reloaded_in_worker"
  else "rebuild"
  end
end

#stale?Boolean

Returns:

  • (Boolean)


23
# File 'lib/siding/staleness.rb', line 23

def stale? = !fresh?

#summaryObject



35
36
37
38
39
40
41
# File 'lib/siding/staleness.rb', line 35

def summary
  return "up to date" if fresh?

  detail = trigger_paths.first
  reason = reasons.first
  detail ? "#{reason}: #{File.basename(detail)}" : reason.to_s
end