Module: Settings

Defined in:
lib/gswax/shared.rb

Class Method Summary collapse

Class Method Details

.at_batObject



70
71
72
# File 'lib/gswax/shared.rb', line 70

def self.at_bat
	@settings[2]
end

.at_bat=(atbat) ⇒ Object



73
74
75
# File 'lib/gswax/shared.rb', line 73

def self.at_bat= (atbat)
	@settings[2] = atbat
end

.bg_colorObject



105
106
107
# File 'lib/gswax/shared.rb', line 105

def self.bg_color
	@settings[7]
end

.bg_color=(rgb_array) ⇒ Object



108
109
110
# File 'lib/gswax/shared.rb', line 108

def self.bg_color= (rgb_array)
	@settings[7] = rgb_array
end

.brains_dirObject



48
49
50
# File 'lib/gswax/shared.rb', line 48

def self.brains_dir
	File.dirname(File.expand_path(__FILE__))
end

.font_descObject



91
92
93
# File 'lib/gswax/shared.rb', line 91

def self.font_desc
	@settings[5]
end

.font_desc=(desc) ⇒ Object



94
95
96
# File 'lib/gswax/shared.rb', line 94

def self.font_desc= (desc)
	@settings[5] = desc
end

.line_upObject



126
127
128
# File 'lib/gswax/shared.rb', line 126

def self.line_up
	@settings[10]
end

.line_up=(line_up) ⇒ Object



129
130
131
# File 'lib/gswax/shared.rb', line 129

def self.line_up= (line_up)
	@settings[10] = line_up
end

.music_dirObject



112
113
114
# File 'lib/gswax/shared.rb', line 112

def self.music_dir
	@settings[8]
end

.music_dir=(dir) ⇒ Object



115
116
117
# File 'lib/gswax/shared.rb', line 115

def self.music_dir= (dir)
	@settings[8] = dir
end

.playlist_fileObject



56
57
58
# File 'lib/gswax/shared.rb', line 56

def self.playlist_file
	@settings[0]
end

.playlist_file=(file) ⇒ Object



59
60
61
# File 'lib/gswax/shared.rb', line 59

def self.playlist_file= (file)
	@settings[0] = file
end

.readObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/gswax/shared.rb', line 14

def self.read		
	brains_dir = File.dirname(File.expand_path(__FILE__))
	@settings_file = File.join(brains_dir, "settings", "settings.yml")
	if File.exists?(@settings_file)
		@settings = begin
			YAML.load(File.open(@settings_file))
		rescue ArgumentError => e
			puts "Unable to parse YAML: #{e.message}"
		end
	else
		@settings = [
			nil,
			false,
			nil,
			"#title# - #artist# - #album#",
			0.65,
			"Impact 13",
			[65000, 65000, 65000],
			[0, 0, 0],
			nil,
			0.5,
			nil
		]
		FileUtils.mkdir_p(File.join(brains_dir, "settings"))
		self.save
	end
end

.saveObject



42
43
44
45
46
# File 'lib/gswax/shared.rb', line 42

def self.save
	File.open(@settings_file, "w"){|file|
			file.write(@settings.to_yaml)
	}
end

.scaleObject



84
85
86
# File 'lib/gswax/shared.rb', line 84

def self.scale
	@settings[4]
end

.scale=(int) ⇒ Object



87
88
89
# File 'lib/gswax/shared.rb', line 87

def self.scale= (int)
	@settings[4] = int
end

.settingsObject



52
53
54
# File 'lib/gswax/shared.rb', line 52

def self.settings
	@settings
end

.shuffleObject



63
64
65
# File 'lib/gswax/shared.rb', line 63

def self.shuffle
	@settings[1]
end

.shuffle=(tof) ⇒ Object



66
67
68
# File 'lib/gswax/shared.rb', line 66

def self.shuffle= (tof)
	@settings[1] = tof
end

.text_colorObject



98
99
100
# File 'lib/gswax/shared.rb', line 98

def self.text_color
	@settings[6]
end

.text_color=(rgb_array) ⇒ Object



101
102
103
# File 'lib/gswax/shared.rb', line 101

def self.text_color= (rgb_array)
	@settings[6] = rgb_array
end

.title_formatObject



77
78
79
# File 'lib/gswax/shared.rb', line 77

def self.title_format
	@settings[3]
end

.title_format=(format) ⇒ Object



80
81
82
# File 'lib/gswax/shared.rb', line 80

def self.title_format= (format)
	@settings[3] = format
end

.volumeObject



119
120
121
# File 'lib/gswax/shared.rb', line 119

def self.volume
	@settings[9]
end

.volume=(vol) ⇒ Object



122
123
124
# File 'lib/gswax/shared.rb', line 122

def self.volume= (vol)
	@settings[9] = vol
end