Module: Settings
- Defined in:
- lib/gswax/shared.rb
Class Method Summary collapse
- .at_bat ⇒ Object
- .at_bat=(atbat) ⇒ Object
- .bg_color ⇒ Object
- .bg_color=(rgb_array) ⇒ Object
- .brains_dir ⇒ Object
- .font_desc ⇒ Object
- .font_desc=(desc) ⇒ Object
- .line_up ⇒ Object
- .line_up=(line_up) ⇒ Object
- .music_dir ⇒ Object
- .music_dir=(dir) ⇒ Object
- .playlist_file ⇒ Object
- .playlist_file=(file) ⇒ Object
- .read ⇒ Object
- .save ⇒ Object
- .scale ⇒ Object
- .scale=(int) ⇒ Object
- .settings ⇒ Object
- .shuffle ⇒ Object
- .shuffle=(tof) ⇒ Object
- .text_color ⇒ Object
- .text_color=(rgb_array) ⇒ Object
- .title_format ⇒ Object
- .title_format=(format) ⇒ Object
- .volume ⇒ Object
- .volume=(vol) ⇒ Object
Class Method Details
.at_bat ⇒ Object
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_color ⇒ Object
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_dir ⇒ Object
48 49 50 |
# File 'lib/gswax/shared.rb', line 48 def self.brains_dir File.dirname(File.(__FILE__)) end |
.font_desc ⇒ Object
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_up ⇒ Object
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_dir ⇒ Object
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_file ⇒ Object
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 |
.read ⇒ Object
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.(__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.}" 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 |
.save ⇒ Object
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 |
.scale ⇒ Object
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 |
.settings ⇒ Object
52 53 54 |
# File 'lib/gswax/shared.rb', line 52 def self.settings @settings end |
.shuffle ⇒ Object
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_color ⇒ Object
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_format ⇒ Object
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 |
.volume ⇒ Object
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 |