Module: Card::Set::Right::MachineOutput::Format

Extended by:
AbstractFormat
Defined in:
card/tmpsets/set/mod016-card-mod-machines/right/machine_output.rb,
card/tmpsets/set/mod015-card-mod-machines/right/machine_output.rb

Instance Method Summary collapse

Instance Method Details

#update_machine_output_live?Boolean

Returns:

  • (Boolean)


40
41
42
43
44
45
46
47
48
49
50
# File 'card/tmpsets/set/mod016-card-mod-machines/right/machine_output.rb', line 40

def update_machine_output_live?
  case
  when !card.left.is_a?(Abstract::Machine) then false # must be a machine
  when card.left.locked?         then false # machine must not be running
  when card.new_card?            then true  # always update if new
  else
    # must want current output (won't re-output old stuff)
    (selected_id = card.selected_action_id) &&
      selected_id == card.last_action_id
  end
end

#view: not_foundObject



29
30
31
32
33
34
35
36
37
38
# File 'card/tmpsets/set/mod016-card-mod-machines/right/machine_output.rb', line 29

view :not_found do
  if update_machine_output_live?
    Card::Cache.reset_all # FIXME: wow, this is overkill, no?
    root.error_status = 302
    card.left.update_machine_output
    card_path card.left.machine_output_url
  else
    super()
  end
end