Sha256: 5d6ecca99ebfe8b5348f128bbd161a37d09514f4268cb8ef9b95eabde0b945b6

Contents?: true

Size: 1.78 KB

Versions: 9

Compression:

Stored size: 1.78 KB

Contents

# -*- encoding : utf-8 -*-
class Card; module Set; class Abstract; module Machine;
# Set: Abstract (Machine, OutputUpdate)
#
module OutputUpdate;
extend Card::Set
def self.source_location; "/Users/ethan/dev/decko/gem/card/mod/machines/set/abstract/machine/output_update.rb"; end
def reset_machine_output
  Auth.as_bot do
    (moc = machine_output_card) && moc.real? && moc.delete!
    update_input_card
  end
end

def regenerate_machine_output
  return unless ok?(:read)
  lock { run_machine }
end

def update_machine_output
  return unless ok?(:read)
  lock do
    update_input_card
    run_machine
  end
end

def ensure_machine_output
  output = fetch trait: :machine_output
  return if output&.selected_content_action_id
  update_machine_output
end

def update_input_card
  if Card::ActManager.running_act?
    input_card = attach_subcard! machine_input_card
    input_card.content = ""
    engine_input.each { |input| input_card << input }
  else
    machine_input_card.items = engine_input
  end
end

def input_cards_with_changed_source output_updated
  machine_input_card.extended_item_cards.select do |i_card|
    i_card.try(:source_changed?, since: output_updated)
  end
end

# regenerates the machine output if a source file of a input card has been changed
def update_if_source_file_changed
  return unless (output_updated = output_updated_at)
  changed = input_cards_with_changed_source(output_updated)
  return if changed.empty?
  changed.each(&:expire_machine_cache)
  regenerate_machine_output
end

def output_updated_at
  return unless (output_card = machine_output_card)
  if output_card.coded?
    File.mtime output_card.file.path
  else
    output_card.updated_at
  end
end
end;end;end;end;end;
# ~~ generated from /Users/ethan/dev/decko/gem/card/mod/machines/set/abstract/machine/output_update.rb ~~

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
card-1.99.4 tmpsets/set/mod014-machines/abstract/machine/output_update.rb
card-1.99.3 tmpsets/set/mod014-machines/abstract/machine/output_update.rb
card-1.99.2 tmpsets/set/mod014-machines/abstract/machine/output_update.rb
card-1.99.1 tmpsets/set/mod014-machines/abstract/machine/output_update.rb
card-1.99.0 tmpsets/set/mod014-machines/abstract/machine/output_update.rb
card-1.98.3 tmpsets/set/mod014-machines/abstract/machine/output_update.rb
card-1.98.2 tmpsets/set/mod014-machines/abstract/machine/output_update.rb
card-1.98.1 tmpsets/set/mod014-machines/abstract/machine/output_update.rb
card-1.98.0 tmpsets/set/mod014-machines/abstract/machine/output_update.rb