Class: Steam::SentryFile

Inherits:
Object
  • Object
show all
Defined in:
lib/steam/sentry_file.rb

Overview

TODO:

this will overwrite any existing file, namespace to username?

Represents a Sentry file on disk

Instance Method Summary collapse

Instance Method Details

#readString?

Read the digest from the sentry file. Returns nil if the Sentry file does not exist.

Examples:

Read the SentryFile

file = SentryFile.new
file.read # => 'somedigest'

Returns:



29
30
31
32
33
# File 'lib/steam/sentry_file.rb', line 29

def read
  return nil unless File.exist?(path)

  File.open(path, 'rb', &:read)
end

#write(digest) ⇒ Object

Writes the digest to the sentry file

Examples:

Write the SentryFile

file = SentryFile.new
file.write('sha1digest')

Parameters:



15
16
17
18
19
# File 'lib/steam/sentry_file.rb', line 15

def write(digest)
  File.open(path, 'wb') do |file|
    file.write(digest)
  end
end