Class: VpsbClient::Builders::CpuinfoParser
- Inherits:
-
SystemInfoParser
- Object
- SystemInfoParser
- VpsbClient::Builders::CpuinfoParser
- 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
-
#mhz ⇒ Object
readonly
Returns the value of attribute mhz.
-
#model ⇒ Object
readonly
Returns the value of attribute model.
-
#num ⇒ Object
readonly
Returns the value of attribute num.
Instance Method Summary collapse
-
#initialize ⇒ CpuinfoParser
constructor
A new instance of CpuinfoParser.
- #parse ⇒ Object
Methods inherited from SystemInfoParser
#find_matches, #find_matches!, #lines
Constructor Details
#initialize ⇒ CpuinfoParser
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
#mhz ⇒ Object (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 |
#model ⇒ Object (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 |
#num ⇒ Object (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
#parse ⇒ Object
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 |