hardware_information 1.0.71

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of hardware_information might be problematic. Click here for more details.

Files changed (39) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +65 -0
  3. data/bin/hardware_information +12 -0
  4. data/doc/README.gen +25 -0
  5. data/hardware_information.gemspec +44 -0
  6. data/lib/hardware_information/class/colours.rb +82 -0
  7. data/lib/hardware_information/class/constants.rb +145 -0
  8. data/lib/hardware_information/class/hardware_information.rb +32 -0
  9. data/lib/hardware_information/class/initialize.rb +24 -0
  10. data/lib/hardware_information/class/make_line.rb +55 -0
  11. data/lib/hardware_information/class/menu.rb +52 -0
  12. data/lib/hardware_information/class/misc.rb +275 -0
  13. data/lib/hardware_information/class/obtain.rb +255 -0
  14. data/lib/hardware_information/class/reset.rb +54 -0
  15. data/lib/hardware_information/class/run.rb +48 -0
  16. data/lib/hardware_information/css/project.css +3 -0
  17. data/lib/hardware_information/gui/gtk2/purchased_hardware/purchased_hardware.rb +34 -0
  18. data/lib/hardware_information/gui/gtk2/show_input_devices/show_input_devices.rb +34 -0
  19. data/lib/hardware_information/gui/gtk3/mounted_harddiscs/mounted_harddiscs.rb +103 -0
  20. data/lib/hardware_information/gui/gtk3/purchased_hardware/purchased_hardware.rb +34 -0
  21. data/lib/hardware_information/gui/gtk3/show_input_devices/show_input_devices.rb +34 -0
  22. data/lib/hardware_information/gui/libui/mounted_harddiscs/mounted_harddiscs.rb +88 -0
  23. data/lib/hardware_information/gui/shared_code/mounted_harddiscs/mounted_harddiscs_module.rb +107 -0
  24. data/lib/hardware_information/gui/shared_code/purchased_hardware/purchased_hardware_module.rb +291 -0
  25. data/lib/hardware_information/gui/shared_code/show_input_devices/show_input_devices_module.rb +187 -0
  26. data/lib/hardware_information/misc/purchased_hardware/README.md +7 -0
  27. data/lib/hardware_information/misc/purchased_hardware/purchased_hardware.rb +169 -0
  28. data/lib/hardware_information/monitor/README.md +6 -0
  29. data/lib/hardware_information/monitor/monitor.rb +36 -0
  30. data/lib/hardware_information/project/project.rb +29 -0
  31. data/lib/hardware_information/version/version.rb +19 -0
  32. data/lib/hardware_information/www/embeddable_interface.rb +52 -0
  33. data/lib/hardware_information/www/my_hardware.cgi +7 -0
  34. data/lib/hardware_information/www/my_hardware.rb +462 -0
  35. data/lib/hardware_information/www/my_hardware_for_sinatra.rb +65 -0
  36. data/lib/hardware_information/yaml/colours_for_the_hardware_information_project.yml +30 -0
  37. data/lib/hardware_information/yaml/usb_errors/usb_errors.yml +2 -0
  38. data/lib/hardware_information.rb +7 -0
  39. metadata +95 -0
@@ -0,0 +1,291 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # === HardwareInformation::GUI::Gtk::PurchasedHardwareModule
6
+ # =========================================================================== #
7
+ # require 'hardware_information/gui/shared_code/purchased_hardware/purchased_hardware_module.rb'
8
+ # include ::HardwareInformation::GUI::Gtk::PurchasedHardwareModule
9
+ # =========================================================================== #
10
+ class HardwareInformation
11
+
12
+ module GUI
13
+
14
+ module Gtk
15
+
16
+ module PurchasedHardwareModule
17
+
18
+ begin
19
+ require 'roebe/modules/remove_html.rb'
20
+ rescue LoadError; end
21
+
22
+ require 'gtk_paradise/requires/require_the_base_module.rb'
23
+ include ::Gtk::BaseModule
24
+
25
+ # ========================================================================= #
26
+ # Include the hardware-related module into this class next:
27
+ # ========================================================================= #
28
+ require 'hardware_information/misc/purchased_hardware/purchased_hardware.rb'
29
+ include HardwareInformation::PurchasedHardware
30
+
31
+ # ========================================================================= #
32
+ # === NAMESPACE
33
+ # ========================================================================= #
34
+ NAMESPACE = inspect
35
+
36
+ # ========================================================================= #
37
+ # === N
38
+ # ========================================================================= #
39
+ N = "\n"
40
+
41
+ # ========================================================================= #
42
+ # === IMG_DIR
43
+ #
44
+ # Specify the path to the local images here.
45
+ # ========================================================================= #
46
+ IMG_DIR = '/home/x/data/images/'
47
+
48
+ # ========================================================================= #
49
+ # === TITLE
50
+ # ========================================================================= #
51
+ TITLE = 'Purchased Hardware'
52
+
53
+ # ========================================================================= #
54
+ # === WIDTH
55
+ # ========================================================================= #
56
+ WIDTH = '80% or minimum 1600px'
57
+
58
+ # ========================================================================= #
59
+ # === HEIGHT
60
+ # ========================================================================= #
61
+ HEIGHT = 600
62
+
63
+ # ========================================================================= #
64
+ # === USE_THIS_FONT
65
+ # ========================================================================= #
66
+ USE_THIS_FONT = :dejavu_condensed_18
67
+
68
+ # ========================================================================= #
69
+ # === initialize
70
+ # ========================================================================= #
71
+ def initialize(
72
+ optional_file = nil,
73
+ run_already = true
74
+ )
75
+ super(:horizontal)
76
+ reset
77
+ run if run_already
78
+ end
79
+
80
+ # ========================================================================= #
81
+ # === reset (reset tag)
82
+ # ========================================================================= #
83
+ def reset
84
+ reset_the_internal_variables
85
+ # ======================================================================= #
86
+ # === @configuration
87
+ # ======================================================================= #
88
+ @configuration = [true, __dir__, NAMESPACE]
89
+ # ======================================================================= #
90
+ # === @title
91
+ # ======================================================================= #
92
+ @title = TITLE
93
+ # ======================================================================= #
94
+ # === @width
95
+ # ======================================================================= #
96
+ set_width(WIDTH)
97
+ # ======================================================================= #
98
+ # === @height
99
+ # ======================================================================= #
100
+ set_height(HEIGHT)
101
+ set_use_this_font(USE_THIS_FONT)
102
+ use_gtk_project_css_file
103
+ infer_the_size_automatically
104
+ end
105
+
106
+ # ========================================================================= #
107
+ # === padding?
108
+ # ========================================================================= #
109
+ def padding?
110
+ 2
111
+ end
112
+
113
+ # ========================================================================= #
114
+ # === border_size?
115
+ # ========================================================================= #
116
+ def border_size?
117
+ 2
118
+ end
119
+
120
+ # ========================================================================= #
121
+ # === create_skeleton (create tag)
122
+ # ========================================================================= #
123
+ def create_skeleton
124
+ @header_on_top = h1('Meine Hardware')
125
+ @header_on_top.left_align
126
+ end
127
+
128
+ # ========================================================================= #
129
+ # === connect_skeleton (connect tag)
130
+ # ========================================================================= #
131
+ def connect_skeleton
132
+ abort_on_exception
133
+ vbox_containing_the_hardware_entries = gtk_vbox
134
+ hbox = gtk_hbox
135
+ hbox.minimal(
136
+ text('♥️ ').red
137
+ )
138
+ hbox.maximal(@header_on_top)
139
+ vbox_containing_the_hardware_entries.add(hbox)
140
+ hbox.add(gtk_horizontal_spacer)
141
+ # ======================================================================= #
142
+ # Next, go through the dataset and add the relevant entries:
143
+ # ======================================================================= #
144
+ dataset = main_dataset?
145
+ dataset.each_pair {|name_of_the_hardware, inner_dataset|
146
+ this_label = h3("# {name_of_the_hardware}")
147
+ if name_of_the_hardware.include? 'id='
148
+ this_label.set_name(
149
+ name_of_the_hardware.scan(/id=(.+)/).flatten.first.to_s
150
+ )
151
+ name_of_the_hardware = Roebe.remove_html(name_of_the_hardware)
152
+ this_label.set_text(name_of_the_hardware)
153
+ end
154
+ this_label.left_align
155
+ this_label.make_bold
156
+ this_label.make_selectable
157
+
158
+ mini_vbox_containing_the_description_for_the_hardware_at_hand = gtk_vbox
159
+ _ = ''.dup
160
+ # ===================================================================== #
161
+ # === image or draggable_image:
162
+ #
163
+ # The first entry contains the desired information.
164
+ #
165
+ # Example:
166
+ #
167
+ # draggable_image:
168
+ # - HARDWARE/DRUCKER/HP_OfficeJet_Pro_6230.jpg
169
+ # - mar1em
170
+ #
171
+ # ===================================================================== #
172
+ if inner_dataset.include?('image') or inner_dataset.include?('draggable_image')
173
+ if inner_dataset.has_key?('draggable_image')
174
+ target = IMG_DIR+inner_dataset['draggable_image'][0]
175
+ elsif inner_dataset.has_key?('draggable_images')
176
+ target = IMG_DIR+inner_dataset['draggable_images'][0]
177
+ else
178
+ target = IMG_DIR+inner_dataset['image'][0]
179
+ end
180
+ this_image = gtk_image(target)
181
+ this_image.align_to_the_left
182
+ this_image.set_name('image1')
183
+ this_image.pad5px
184
+ this_image.bblack1
185
+ this_image.set_border_width(8)
186
+ mini_vbox_containing_the_description_for_the_hardware_at_hand.minimal(
187
+ this_image
188
+ )
189
+ end
190
+ # ===================================================================== #
191
+ # === description
192
+ # ===================================================================== #
193
+ if inner_dataset.include? 'description'
194
+ _ << '<b>Beschreibung</b>: '+
195
+ Roebe.remove_html(
196
+ inner_dataset['description'].to_s.
197
+ gsub(/<br><br>/,"\n<br>").
198
+ gsub(/<br>/,"")
199
+ )+N
200
+ end
201
+ # ===================================================================== #
202
+ # === cost
203
+ # ===================================================================== #
204
+ if inner_dataset.include? 'cost'
205
+ cost = inner_dataset['cost'].to_s
206
+ _ << '<b>cost</b>: '+cost+' Euro'+N
207
+ HardwareInformation::PurchasedHardware.add_to_total_cost(
208
+ cost.to_f
209
+ )
210
+ end
211
+ # ===================================================================== #
212
+ # === bought_at
213
+ #
214
+ # Add information when the particular hardware at hand was purchased.
215
+ # ===================================================================== #
216
+ if inner_dataset.include? 'bought_at'
217
+ _ << '<b>erstanden am</b>: '+
218
+ '<span weight="bold" foreground="darkblue">'+
219
+ inner_dataset['bought_at'].to_s+
220
+ '</span>'+
221
+ N
222
+ end
223
+ # ===================================================================== #
224
+ # Next comes the description ("Beschreibung"), which may be really
225
+ # long.
226
+ # ===================================================================== #
227
+ if _.include? '<a href' # Add support for hyperlinks here.
228
+ _ = parse_hyperlinks(_)
229
+ end
230
+ description_for_the_hardware_at_hand = label(_)
231
+ description_for_the_hardware_at_hand.left_align
232
+ description_for_the_hardware_at_hand.make_selectable
233
+ mini_vbox_containing_the_description_for_the_hardware_at_hand.maximal(
234
+ description_for_the_hardware_at_hand, 5
235
+ )
236
+ name_of_the_hardware = Roebe.remove_html(name_of_the_hardware)
237
+ this_label.set_text(name_of_the_hardware)
238
+ tiny_hbox_containing_computer_image_and_the_big_label = gtk_hbox
239
+ # ===================================================================== #
240
+ # Next we will add the tiny computer-image, with some padding.
241
+ # ===================================================================== #
242
+ tiny_hbox_containing_computer_image_and_the_big_label.minimal(
243
+ image_computer, 12
244
+ )
245
+ tiny_hbox_containing_computer_image_and_the_big_label.maximal(
246
+ this_label
247
+ )
248
+ vbox_containing_the_hardware_entries.add(
249
+ tiny_hbox_containing_computer_image_and_the_big_label
250
+ )
251
+ vbox_containing_the_hardware_entries.add(
252
+ mini_vbox_containing_the_description_for_the_hardware_at_hand
253
+ )
254
+ vbox_containing_the_hardware_entries.add(gtk_horizontal_spacer)
255
+ }
256
+ text = '<b>Gesamtkosten</b>: <b>'+
257
+ HardwareInformation::PurchasedHardware.total_cost?.to_s.to_f.round(2).to_s+
258
+ ' Euro</b>'
259
+ vbox_containing_the_hardware_entries.add(
260
+ h2(text).align_left
261
+ )
262
+ # ======================================================================= #
263
+ # Add the big vbox into a scrolled-window interface.
264
+ # ======================================================================= #
265
+ scrolled_window = gtk_scrolled_window(vbox_containing_the_hardware_entries) { :only_up_and_down }
266
+ scrolled_window.set_size_request(1400, 800)
267
+ maximal(scrolled_window)
268
+ end
269
+
270
+ # ========================================================================= #
271
+ # === run (run tag)
272
+ # ========================================================================= #
273
+ def run
274
+ create_skeleton_then_connect_skeleton
275
+ end
276
+
277
+ # ========================================================================= #
278
+ # === HardwareInformation::GUI::Gtk::PurchasedHardwareModule.run
279
+ # ========================================================================= #
280
+ def self.run(
281
+ i = ARGV
282
+ )
283
+ require 'gtk_paradise/run'
284
+ _ = ::HardwareInformation::GUI::Gtk::PurchasedHardware.new(i)
285
+ r = ::Gtk.run
286
+ r << _
287
+ r.set_size_request(_.width?, _.height?)
288
+ r.top_left_then_run
289
+ end
290
+
291
+ end; end; end; end
@@ -0,0 +1,187 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # === HardwareInformation::GUI::Gtk::ShowInputDevicesModule
6
+ # =========================================================================== #
7
+ # require 'hardware-information/gui/shared_code/foobar/foobar_module.rb'
8
+ # include ::HardwareInformation::GUI::Gtk::ShowInputDevicesModule
9
+ # =========================================================================== #
10
+ class HardwareInformation
11
+
12
+ module GUI
13
+
14
+ module Gtk
15
+
16
+ module ShowInputDevicesModule
17
+
18
+ require 'gtk_paradise/requires/require_the_base_module.rb'
19
+ include ::Gtk::BaseModule
20
+
21
+ # ========================================================================= #
22
+ # Include the hardware-related module into this class next:
23
+ # ========================================================================= #
24
+ require 'hardware_information/misc/purchased_hardware/purchased_hardware.rb'
25
+ include HardwareInformation::PurchasedHardware
26
+
27
+ # ========================================================================= #
28
+ # === NAMESPACE
29
+ # ========================================================================= #
30
+ NAMESPACE = inspect
31
+
32
+ # ========================================================================= #
33
+ # === TITLE
34
+ # ========================================================================= #
35
+ TITLE = 'Show Input Devices'
36
+
37
+ # ========================================================================= #
38
+ # === WIDTH
39
+ # ========================================================================= #
40
+ WIDTH = 1600
41
+
42
+ # ========================================================================= #
43
+ # === HEIGHT
44
+ # ========================================================================= #
45
+ HEIGHT = 860
46
+
47
+ # ========================================================================= #
48
+ # === FONT_TO_USE_FOR_THE_SCROLLED_WINDOWS
49
+ # ========================================================================= #
50
+ FONT_TO_USE_FOR_THE_SCROLLED_WINDOWS = :hack_20
51
+
52
+ # ========================================================================= #
53
+ # === initialize
54
+ # ========================================================================= #
55
+ def initialize(
56
+ optional_file = nil,
57
+ run_already = true
58
+ )
59
+ super(:vertical)
60
+ reset
61
+ run if run_already
62
+ end
63
+
64
+ # ========================================================================= #
65
+ # === reset (reset tag)
66
+ # ========================================================================= #
67
+ def reset
68
+ reset_the_internal_variables
69
+ # ======================================================================= #
70
+ # === @configuration
71
+ # ======================================================================= #
72
+ @configuration = [true, __dir__, NAMESPACE]
73
+ # ======================================================================= #
74
+ # === @title
75
+ # ======================================================================= #
76
+ @title = TITLE
77
+ # ======================================================================= #
78
+ # === @width
79
+ # ======================================================================= #
80
+ set_width(WIDTH)
81
+ # ======================================================================= #
82
+ # === @height
83
+ # ======================================================================= #
84
+ set_height(HEIGHT)
85
+ set_use_this_font(:dejavu_condensed_21)
86
+ use_gtk_paradise_project_css_file
87
+ infer_the_size_automatically
88
+ end
89
+
90
+ # ========================================================================= #
91
+ # === padding?
92
+ # ========================================================================= #
93
+ def padding?
94
+ 2
95
+ end
96
+
97
+ # ========================================================================= #
98
+ # === border_size?
99
+ # ========================================================================= #
100
+ def border_size?
101
+ 2
102
+ end
103
+
104
+ # ========================================================================= #
105
+ # === create_skeleton (create tag)
106
+ # ========================================================================= #
107
+ def create_skeleton
108
+ end
109
+
110
+ # ========================================================================= #
111
+ # === connect_skeleton (connect tag)
112
+ # ========================================================================= #
113
+ def connect_skeleton
114
+ Thread.abort_on_exception = true
115
+ result = `xinput --list --short`.to_s.strip
116
+ @text_buffer = gtk_text_buffer
117
+ text_view = gtk_text_view(@text_buffer)
118
+ text_view.set_text(result.to_s)
119
+ scrolled_window = gtk_scrolled_window(text_view) { :always }
120
+ scrolled_window.set_size_request(1200, 400)
121
+ scrolled_window.set_font(FONT_TO_USE_FOR_THE_SCROLLED_WINDOWS)
122
+ frame = gtk_frame(scrolled_window)
123
+ frame.set_text('Show input devices')
124
+ frame.set_border_width(10)
125
+ frame.set_font :hack_24
126
+ frame.make_bold
127
+ maximal(frame, 20)
128
+ add(gtk_separator)
129
+ mini_hbox = gtk_hbox
130
+ entry_for_listing_props = gtk_entry(
131
+ 'xinput --list-props "Logitech USB Optical Mouse"'
132
+ )
133
+ button_activate_the_entry_for_listing_props = gtk_button('_run')
134
+ button_activate_the_entry_for_listing_props.hint =
135
+ 'This will run the content on the left side.'
136
+ button_activate_the_entry_for_listing_props.set_size_request(100, 30)
137
+ button_activate_the_entry_for_listing_props.css_class('bblack2')
138
+ button_activate_the_entry_for_listing_props.on_clicked {
139
+ do_fill_up_text_buffer2_with_this_content_from_that_entry(
140
+ entry_for_listing_props
141
+ )
142
+ }
143
+ mini_hbox.maximal(entry_for_listing_props, 2)
144
+ mini_hbox.minimal(button_activate_the_entry_for_listing_props, 2)
145
+ add(mini_hbox)
146
+ @text_buffer2 = gtk_text_buffer
147
+ text_view2 = gtk_text_view(@text_buffer2)
148
+ scrolled_window2 = gtk_scrolled_window(text_view2) { :always }
149
+ scrolled_window2.set_size_request(1200, 300)
150
+ scrolled_window2.set_font(FONT_TO_USE_FOR_THE_SCROLLED_WINDOWS)
151
+ add(scrolled_window2)
152
+ end
153
+
154
+ # ========================================================================= #
155
+ # === do_fill_up_text_buffer2_with_this_content_from_that_entry
156
+ # ========================================================================= #
157
+ def do_fill_up_text_buffer2_with_this_content_from_that_entry(
158
+ entry_to_use
159
+ )
160
+ _ = entry_to_use.text?
161
+ result = `#{_}`.to_s.strip
162
+ @text_buffer2.set_text(result)
163
+ end
164
+
165
+ # ========================================================================= #
166
+ # === run (run tag)
167
+ # ========================================================================= #
168
+ def run
169
+ create_skeleton_then_connect_skeleton
170
+ end
171
+
172
+ # ========================================================================= #
173
+ # === HardwareInformation::GUI::Gtk::ShowInputDevicesModule.run
174
+ # ========================================================================= #
175
+ def self.run(
176
+ i = ARGV
177
+ )
178
+ require 'gtk_paradise/run'
179
+ _ = ::HardwareInformation::GUI::Gtk::ShowInputDevices.new(i)
180
+ r = ::Gtk.run
181
+ r << _
182
+ r.determine_the_title_from_the_child_widget
183
+ r.set_size_request(_.width?, _.height?)
184
+ r.top_left_then_run
185
+ end
186
+
187
+ end; end; end; end
@@ -0,0 +1,7 @@
1
+ This module called PurchasedHardware was created in January of 2021.
2
+
3
+ It had to be added because I wanted to show which hardware I purchased
4
+ over the years, and display this information on the www as well as
5
+ via a ruby-gtk3 widget. In particular for the latter I had to rewrite
6
+ a lot of code that was only usable on the www, to make things
7
+ more modular.
@@ -0,0 +1,169 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # === HardwareInformation::PurchasedHardware
6
+ #
7
+ # This module has been primarily written to support the old content
8
+ # shown in the old .cgi file. By having this available as a module
9
+ # we can, in principle, adapt this easily into sinatra or rails as
10
+ # well, so we gain more flexibility by using a module here.
11
+ # =========================================================================== #
12
+ # require 'hardware_information/misc/purchased_hardware/purchased_hardware.rb'
13
+ # include HardwareInformation::PurchasedHardware
14
+ # =========================================================================== #
15
+ class HardwareInformation
16
+
17
+ module PurchasedHardware
18
+
19
+ require 'yaml'
20
+
21
+ # ========================================================================= #
22
+ # === HardwareInformation::PurchasedHardware.title?
23
+ # ========================================================================= #
24
+ def self.title?
25
+ 'Meine Hardware'
26
+ end
27
+
28
+ # ========================================================================= #
29
+ # === HardwareInformation::PurchasedHardware.body_css_class
30
+ # ========================================================================= #
31
+ def self.body_css_class
32
+ 'BG_BLACK pad0_4em'
33
+ end
34
+
35
+ # ========================================================================= #
36
+ # === HardwareInformation::PurchasedHardware.body_css_style
37
+ # ========================================================================= #
38
+ def self.body_css_style
39
+ return '
40
+ border-top: 3px solid orange;
41
+ border-left: 3px solid orange;
42
+ color: #ceffce;
43
+ width: 100%;'
44
+ end
45
+
46
+ # ========================================================================= #
47
+ # === COLOUR_PURCHASED_AT_THIS_DATE
48
+ # ========================================================================= #
49
+ COLOUR_PURCHASED_AT_THIS_DATE = 'mistyrose' # wann ich es gekauft habe
50
+
51
+ # ========================================================================= #
52
+ # === @total_cost
53
+ #
54
+ # Keep track of the total cost, in euro.
55
+ # ========================================================================= #
56
+ @total_cost = 0
57
+
58
+ # ========================================================================= #
59
+ # === HardwareInformation::PurchasedHardware.add_to_the_total_cost
60
+ # ========================================================================= #
61
+ def self.add_to_the_total_cost(i)
62
+ @total_cost += i.to_f
63
+ end; self.instance_eval { alias add_to_total_cost add_to_the_total_cost } # === HardwareInformation::PurchasedHardware.add_to_total_cost
64
+
65
+ # ========================================================================= #
66
+ # === HardwareInformation::PurchasedHardware.total_cost?
67
+ # ========================================================================= #
68
+ def self.total_cost?
69
+ @total_cost
70
+ end
71
+
72
+ # ========================================================================= #
73
+ # === MAIN_DIV
74
+ #
75
+ # CSS-related Constants are defined next.
76
+ # ========================================================================= #
77
+ MAIN_DIV = 'pad0_5em mart0_2em'
78
+
79
+ # ========================================================================= #
80
+ # === LINUX_YAML
81
+ #
82
+ # A hardcoded path.
83
+ # ========================================================================= #
84
+ LINUX_YAML = '/home/x/data/PC/OS/LINUX/yaml/'
85
+
86
+ # ========================================================================= #
87
+ # === HardwareInformation::PurchasedHardware.linux_yaml_directory?
88
+ # ========================================================================= #
89
+ def self.linux_yaml_directory?
90
+ LINUX_YAML
91
+ end
92
+
93
+ # ========================================================================= #
94
+ # === HardwareInformation::PurchasedHardware.file_computer_hardware?
95
+ #
96
+ # All the important data is stored in the following .yml file:
97
+ #
98
+ # bl /home/x/DATA/PC/OS/LINUX/yaml/computer_hardware.yml
99
+ #
100
+ # ========================================================================= #
101
+ def self.file_computer_hardware?
102
+ '/home/x/data/personal/yaml/my_hardware/my_hardware.yml'
103
+ end
104
+
105
+ # ========================================================================= #
106
+ # === HardwareInformation::PurchasedHardware.file_my_hardware
107
+ #
108
+ # See:
109
+ #
110
+ # bl /home/x/data/personal/yaml/my_hardware/my_hardware.yml
111
+ #
112
+ # ========================================================================= #
113
+ def self.file_my_hardware
114
+ "/home/x/data/personal/yaml/my_hardware/my_hardware.yml"
115
+ end
116
+
117
+ # ========================================================================= #
118
+ # === HardwareInformation::PurchasedHardware.my_hardware
119
+ #
120
+ # This method will return the hash I use for the hardware I have
121
+ # purchased over the years.
122
+ # ========================================================================= #
123
+ def self.my_hardware(i = file_my_hardware)
124
+ YAML.load_file(i)
125
+ end
126
+
127
+ # ========================================================================= #
128
+ # === main_dataset?
129
+ # ========================================================================= #
130
+ def main_dataset?
131
+ ::HardwareInformation::PurchasedHardware.my_hardware
132
+ end
133
+
134
+ # ========================================================================= #
135
+ # === HardwareInformation::PurchasedHardware.return_dataset_from_the_file_computer_hardware
136
+ #
137
+ # This will return the dataset stored in the .yml file.
138
+ # ========================================================================= #
139
+ def self.return_dataset_from_the_file_computer_hardware
140
+ _ = file_computer_hardware?
141
+ if File.exist? _
142
+ return YAML.load_file(_)
143
+ end
144
+ end
145
+
146
+ # ========================================================================= #
147
+ # === @array_date_bought_at
148
+ # ========================================================================= #
149
+ @array_date_bought_at = []
150
+
151
+ # ========================================================================= #
152
+ # === HardwareInformation::PurchasedHardware.add_bought_at
153
+ #
154
+ # This method will only add non-nil values.
155
+ # ========================================================================= #
156
+ def self.add_bought_at(i)
157
+ unless i.nil?
158
+ @array_date_bought_at << i
159
+ end
160
+ end
161
+
162
+ # ========================================================================= #
163
+ # === HardwareInformation::PurchasedHardware.bought_at?
164
+ # ========================================================================= #
165
+ def self.bought_at?
166
+ return @array_date_bought_at
167
+ end
168
+
169
+ end; end
@@ -0,0 +1,6 @@
1
+ This subdirectory may contain code that can specifically
2
+ deal with monitors (e. g. monitors attached to a computer).
3
+
4
+ For now, we only query the resolution, but in the future
5
+ we may add support for EDID, so that we can determine
6
+ which monitor is in use on the given computer system.