Sha256: 1e4b2e97d5aa657a6eab96e8f0fbb40860b8132a3f71974c7ea9e94360ba7526

Contents?: true

Size: 903 Bytes

Versions: 1

Compression:

Stored size: 903 Bytes

Contents

# -*- coding: utf-8 -*-
class AppMainBase
  def initialize
    @config = nil
    @aboet = false
    @exec = false
    @suspend = false
    @ws = nil
  end

  def app_send(str)
    if @ws != nil
      @ws.send(str)
    end
  end

  def set_ws(ws)
    @ws = ws
  end

  def set_config(config)
    @config = config
  end

  def start(argv)
    @exec = true
  end

  def stop()
    @abort = true
    @exec = false
  end

  def suspend()
    @suspend = true
  end

  def resume()
    @suspend = false
  end

  # 履歴の保存
  def add_history(file, history_data, max = 10)
    buf = File.read "history/#{file}"
    data = eval(buf)
    if data == nil
      data = []
    end
    if history_data.to_s != ""
      data.prepend history_data
    end
    data = data.uniq[0..max - 1]
    File.open("history/#{file}", "w") do |f|
      f.write JSON.pretty_generate data
    end
  end
end

require "app_load.rb"

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
browser_app_base-0.1.0 lib/template/server_app_base.rb