Class: Lshw::System

Inherits:
Object
  • Object
show all
Defined in:
lib/lshw/system.rb

Constant Summary collapse

CPU_PATH =
"//node[@class='processor']"
DESCRIPTION_PATH =
'/list/node/description'
DISKS_PATH =
"//node[@id='disk']"
MEMORY_PATH =
"//node[@id='memory']"
NETWORK_PATH =
"//node[@class='network' and @handle!='']"
PRODUCT_PATH =
'/list/node/product'

Instance Method Summary collapse

Constructor Details

#initialize(hw) ⇒ System

Returns a new instance of System.



12
13
14
# File 'lib/lshw/system.rb', line 12

def initialize(hw)
  @hw = hw
end

Instance Method Details

#cpusObject



16
17
18
# File 'lib/lshw/system.rb', line 16

def cpus
  @hw.search(CPU_PATH).collect { |cpu| ::Lshw::CPU.new cpu }
end

#descriptionObject



20
21
22
# File 'lib/lshw/system.rb', line 20

def description
  @hw.search(DESCRIPTION_PATH).text
end

#disksObject



24
25
26
# File 'lib/lshw/system.rb', line 24

def disks
  @hw.search(DISKS_PATH).collect { |disk| ::Lshw::Disk.new disk }
end

#memoryObject



28
29
30
# File 'lib/lshw/system.rb', line 28

def memory
  ::Lshw::Memory.new @hw.search(MEMORY_PATH)
end

#network_interfacesObject



32
33
34
# File 'lib/lshw/system.rb', line 32

def network_interfaces
  @hw.search(NETWORK_PATH).collect { |i| ::Lshw::NetworkInterface.new i }
end

#productObject



36
37
38
# File 'lib/lshw/system.rb', line 36

def product
  @hw.search(PRODUCT_PATH).text
end