Module: WinUtilinfo::HardwareMethods

Included in:
WinUtilinfo
Defined in:
lib/win_utilinfo/hardware_methods.rb

Instance Method Summary collapse

Instance Method Details

#get_dimensionsObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/win_utilinfo/hardware_methods.rb', line 19

def get_dimensions
	screen_width = `wmic desktopmonitor get screenwidth | more +1`.strip!
	screen_height = `wmic desktopmonitor get screenheight | more +1`.strip!
	screen_dimensions = []

	if screen_width.count("\n") > 1 && screen_height.count("\n") > 1
		screen_widths = screen_width.split("\n")
		screen_heights = screen_height.split("\n")
		screen_widths.each_with_index do |screen_w, index|
			if screen_w.strip.length < 1
				next
			end
			screen_w.strip!
			dimensions = "#{screen_w}x#{screen_heights[index]}"
			screen_dimensions.concat([dimensions])
		end
	else
		screen_dimensions = "#{screen_width}x#{screen_height}"
	end

	return screen_dimensions
end

#get_manufacturerObject



4
5
6
7
# File 'lib/win_utilinfo/hardware_methods.rb', line 4

def get_manufacturer
	manufacturer = `wmic computersystem get Manufacturer | more +1`.strip!
	return manufacturer			
end

#get_modelObject



9
10
11
12
# File 'lib/win_utilinfo/hardware_methods.rb', line 9

def get_model
	model = `wmic computersystem get Model | more +1`.strip!
	return model
end

#get_processor_countObject



14
15
16
17
# File 'lib/win_utilinfo/hardware_methods.rb', line 14

def get_processor_count
	processor_count = `wmic computersystem get NumberofProcessors | more +1`.strip!
	return processor_count
end