Sha256: e249c396080558dad0afce22c4b8807b41d4b5a1377232d77f7a9674008377de

Contents?: true

Size: 1.01 KB

Versions: 26

Compression:

Stored size: 1.01 KB

Contents

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

format do
  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

Version data entries

26 entries across 26 versions & 2 rubygems

Version Path
card-mod-machines-0.13.4 set/right/machine_output.rb
card-mod-machines-0.13.3 set/right/machine_output.rb
card-mod-machines-0.13.2 set/right/machine_output.rb
card-mod-machines-0.13.1 set/right/machine_output.rb
card-mod-machines-0.13.0 set/right/machine_output.rb
card-mod-machines-0.11.7 set/right/machine_output.rb
card-mod-machines-0.12.0 set/right/machine_output.rb
card-mod-machines-0.11.6 set/right/machine_output.rb
card-mod-machines-0.11.5 set/right/machine_output.rb
card-mod-machines-0.11.4 set/right/machine_output.rb
card-mod-machines-0.11.3 set/right/machine_output.rb
card-mod-machines-0.11.2 set/right/machine_output.rb
card-mod-machines-0.11.1 set/right/machine_output.rb
card-mod-machines-0.11.0 set/right/machine_output.rb
card-1.100.0 mod/machines/set/right/machine_output.rb
card-1.99.6 mod/machines/set/right/machine_output.rb
card-1.99.5 mod/machines/set/right/machine_output.rb
card-1.99.4 mod/machines/set/right/machine_output.rb
card-1.99.3 mod/machines/set/right/machine_output.rb
card-1.99.2 mod/machines/set/right/machine_output.rb