Class: SteamPath
- Inherits:
-
Object
- Object
- SteamPath
- Defined in:
- lib/fix-steam-font/steam_path.rb
Overview
Represents a path to the Steam installation.
Instance Attribute Summary collapse
-
#config_path ⇒ Object
readonly
Returns the value of attribute config_path.
Instance Method Summary collapse
- #empty? ⇒ Boolean
- #exists? ⇒ Boolean
-
#initialize ⇒ SteamPath
constructor
A new instance of SteamPath.
-
#load ⇒ Object
Load path from configuration file.
- #save(path) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize ⇒ SteamPath
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.('~'), 'fix-steam-font.yaml' end |
Instance Attribute Details
#config_path ⇒ Object (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
16 17 18 |
# File 'lib/fix-steam-font/steam_path.rb', line 16 def empty? @path.to_s.empty? end |
#exists? ⇒ Boolean
20 21 22 |
# File 'lib/fix-steam-font/steam_path.rb', line 20 def exists? File.exists? @path end |
#load ⇒ Object
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_s ⇒ Object
12 13 14 |
# File 'lib/fix-steam-font/steam_path.rb', line 12 def to_s @path.to_s end |