Module: Fog::Proxmox::CpuHelper

Defined in:
lib/fog/proxmox/helpers/cpu_helper.rb

Overview

module Cpu mixins

Class Method Summary collapse

Class Method Details

.extract(cpu) ⇒ Object


24
25
26
# File 'lib/fog/proxmox/helpers/cpu_helper.rb', line 24

def self.extract(cpu)
  cpu&.scan(/^(cputype=)?(\w+)(,flags=){0,1}(\+[\w-]+){0,1}[;]{0,1}(\+[\w-]+){0,1}/)&.first
end

.extract_pcid(cpu) ⇒ Object


32
33
34
# File 'lib/fog/proxmox/helpers/cpu_helper.rb', line 32

def self.extract_pcid(cpu)
  has?('+pcid', cpu)
end

.extract_spectre(cpu) ⇒ Object


36
37
38
# File 'lib/fog/proxmox/helpers/cpu_helper.rb', line 36

def self.extract_spectre(cpu)
  has?('+spec-ctrl', cpu)
end

.extract_type(cpu) ⇒ Object


28
29
30
# File 'lib/fog/proxmox/helpers/cpu_helper.rb', line 28

def self.extract_type(cpu)
  extract(cpu)[1] if cpu
end

.has?(value, cpu) ⇒ Boolean

Returns:

  • (Boolean)

40
41
42
# File 'lib/fog/proxmox/helpers/cpu_helper.rb', line 40

def self.has?(value, cpu)
  extract(cpu).include? value if cpu
end