Class: VpsbClient::Builders::CpuinfoParser

Inherits:
SystemInfoParser show all
Defined in:
lib/vpsb_client/builders/system_info_parser.rb

Constant Summary collapse

REGEX =

model name : Intel® Xeon® CPU E5-2670 0 @ 2.60GHz

Regexp.new('^model name\s*:\s*(?<model>.*$)')
REGEX_PROCESSOR =
Regexp.new('^Processor\s*:\s*(?<model>.*$)')

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from SystemInfoParser

#find_matches, #find_matches!, #lines

Constructor Details

#initializeCpuinfoParser

Returns a new instance of CpuinfoParser.



80
81
82
# File 'lib/vpsb_client/builders/system_info_parser.rb', line 80

def initialize
  super('cat /proc/cpuinfo')
end

Instance Attribute Details

#mhzObject (readonly)

Returns the value of attribute mhz.



75
76
77
# File 'lib/vpsb_client/builders/system_info_parser.rb', line 75

def mhz
  @mhz
end

#modelObject (readonly)

Returns the value of attribute model.



75
76
77
# File 'lib/vpsb_client/builders/system_info_parser.rb', line 75

def model
  @model
end

#numObject (readonly)

Returns the value of attribute num.



75
76
77
# File 'lib/vpsb_client/builders/system_info_parser.rb', line 75

def num
  @num
end

Instance Method Details

#parseObject



84
85
86
87
88
89
90
# File 'lib/vpsb_client/builders/system_info_parser.rb', line 84

def parse
  matches = find_matches(REGEX)
  matches = find_matches!(REGEX_PROCESSOR) unless matches
  @model = matches[:model]
  parse_num_processors
  parse_cpu_speed
end