Class: SteamPath

Inherits:
Object
  • Object
show all
Defined in:
lib/fix-steam-font/steam_path.rb

Overview

Represents a path to the Steam installation.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeSteamPath

Returns a new instance of SteamPath.



7
8
9
10
# File 'lib/fix-steam-font/steam_path.rb', line 7

def initialize
  @path = nil
  @config_path = File.join File.expand_path('~'), 'fix-steam-font.yaml'
end

Instance Attribute Details

#config_pathObject (readonly)

Returns the value of attribute config_path.



5
6
7
# File 'lib/fix-steam-font/steam_path.rb', line 5

def config_path
  @config_path
end

Instance Method Details

#empty?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/fix-steam-font/steam_path.rb', line 16

def empty?
  @path.to_s.empty?
end

#exists?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/fix-steam-font/steam_path.rb', line 20

def exists?
  File.exists? @path
end

#loadObject

Load path from configuration file.



25
26
27
28
# File 'lib/fix-steam-font/steam_path.rb', line 25

def load
  config = YAML.load_file @config_path
  @path = config['steam']
end

#save(path) ⇒ Object



30
31
32
33
# File 'lib/fix-steam-font/steam_path.rb', line 30

def save(path)
  @path = path
  File.open(@config_path, 'w') {|file| file << "steam: #{@path}"}
end

#to_sObject



12
13
14
# File 'lib/fix-steam-font/steam_path.rb', line 12

def to_s
  @path.to_s
end