Sha256: f040f90db86efc6eb45c11d8bc882543b51e6020ae0b8e2b24f6b5f34a6e3550

Contents?: true

Size: 1.46 KB

Versions: 8

Compression:

Stored size: 1.46 KB

Contents

# -*- encoding : utf-8 -*-
class Card; module Set; class Right
# Set: All "+MachineOutput" cards
#
module MachineOutput;
extend Card::Set
def self.source_location; "/Users/ethan/dev/decko/gem/card-mod-machines/set/right/machine_output.rb"; end
def followable?
  false
end

def ok_to_read
  left.ok_to_read
end

def history?
  false
end

event :remove_codename, :prepare_to_validate,
      on: :delete,
      when: proc { |c| c.codename.present? } do
  # load file before deleting codename otherwise it will fail later
  attachment
  self.codename = nil
end

module Format; module_parent.send :register_set_format, Card::Format, self; extend Card::Set::AbstractFormat
  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

  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
end
end;end;end;end;
# ~~ generated from /Users/ethan/dev/decko/gem/card-mod-machines/set/right/machine_output.rb ~~

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
card-1.101.7 tmpsets/set/mod015-card-mod-machines/right/machine_output.rb
card-1.101.6 tmpsets/set/mod015-card-mod-machines/right/machine_output.rb
card-1.101.5 tmpsets/set/mod016-card-mod-machines/right/machine_output.rb
card-1.101.4 tmpsets/set/mod016-card-mod-machines/right/machine_output.rb
card-1.101.3 tmpsets/set/mod016-card-mod-machines/right/machine_output.rb
card-1.101.2 tmpsets/set/mod016-card-mod-machines/right/machine_output.rb
card-1.101.1 tmpsets/set/mod016-card-mod-machines/right/machine_output.rb
card-1.101.0 tmpsets/set/mod016-card-mod-machines/right/machine_output.rb