Sha256: 41246611ef14f7d0c73c2076e243cf4244142fbef768eef7b84882b2ccaaeb5f

Contents?: true

Size: 426 Bytes

Versions: 2

Compression:

Stored size: 426 Bytes

Contents

class ProconBypassMan::WriteSessionIdCommand
  # @return [String] session_id ラズパイが起動してからshutdownするまで同じ文字列を返す
  # 起動すると/tmp がなくなる前提の実装
  def self.execute
    path = "/tmp/pbm_session_id"
    if(sid = File.read(path))
      return sid
    end
  rescue Errno::ENOENT
    File.write(path, "s_#{SecureRandom.uuid}")
    return SecureRandom.uuid
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
procon_bypass_man-0.1.13 lib/procon_bypass_man/commands/write_session_id_command.rb
procon_bypass_man-0.1.12 lib/procon_bypass_man/commands/write_session_id_command.rb