module WinUtilinfo::HardwareMethods

Public Instance Methods

get_dimensions() click to toggle source
# 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_manufacturer() click to toggle source
# File lib/win_utilinfo/hardware_methods.rb, line 4
def get_manufacturer
        manufacturer = `wmic computersystem get Manufacturer | more +1`.strip!
        return manufacturer                  
end
get_model() click to toggle source
# 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_count() click to toggle source
# 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