Class: Pvectl::Models::Capability
- Defined in:
- lib/pvectl/models/capability.rb
Overview
Represents a single node capability entry — either a supported QEMU CPU model or a supported QEMU machine type.
The two kinds share a flat structure with different optional fields populated. A small, kind-aware model keeps the presenter simple while still allowing JSON/YAML output to expose all relevant attributes.
Instance Attribute Summary collapse
-
#changes ⇒ String?
readonly
Notable changes for the version (only :machine).
-
#custom ⇒ Boolean
readonly
True when this is a custom CPU model (only :cpu).
-
#kind ⇒ Symbol
readonly
Capability kind: :cpu or :machine.
-
#machine_type ⇒ String?
readonly
Machine type — q35 or i440fx (only :machine).
-
#name ⇒ String?
readonly
Identifying name (CPU model or machine id).
-
#node_name ⇒ String?
readonly
Node the capability belongs to.
-
#vendor ⇒ String?
readonly
CPU vendor (only for :cpu kind).
-
#version ⇒ String?
readonly
Machine version (only :machine).
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ Capability
constructor
Creates a new Capability.
Constructor Details
#initialize(attributes = {}) ⇒ Capability
Creates a new Capability.
49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/pvectl/models/capability.rb', line 49 def initialize(attributes = {}) super @node_name = @attributes[:node_name] @kind = @attributes[:kind] @name = @attributes[:name] @vendor = @attributes[:vendor] @custom = @attributes[:custom] || false @machine_type = @attributes[:machine_type] @version = @attributes[:version] @changes = @attributes[:changes] end |
Instance Attribute Details
#changes ⇒ String? (readonly)
Returns notable changes for the version (only :machine).
44 45 46 |
# File 'lib/pvectl/models/capability.rb', line 44 def changes @changes end |
#custom ⇒ Boolean (readonly)
Returns true when this is a custom CPU model (only :cpu).
35 36 37 |
# File 'lib/pvectl/models/capability.rb', line 35 def custom @custom end |
#kind ⇒ Symbol (readonly)
Returns capability kind: :cpu or :machine.
26 27 28 |
# File 'lib/pvectl/models/capability.rb', line 26 def kind @kind end |
#machine_type ⇒ String? (readonly)
Returns machine type — q35 or i440fx (only :machine).
38 39 40 |
# File 'lib/pvectl/models/capability.rb', line 38 def machine_type @machine_type end |
#name ⇒ String? (readonly)
Returns identifying name (CPU model or machine id).
29 30 31 |
# File 'lib/pvectl/models/capability.rb', line 29 def name @name end |
#node_name ⇒ String? (readonly)
Returns node the capability belongs to.
23 24 25 |
# File 'lib/pvectl/models/capability.rb', line 23 def node_name @node_name end |
#vendor ⇒ String? (readonly)
Returns CPU vendor (only for :cpu kind).
32 33 34 |
# File 'lib/pvectl/models/capability.rb', line 32 def vendor @vendor end |
#version ⇒ String? (readonly)
Returns machine version (only :machine).
41 42 43 |
# File 'lib/pvectl/models/capability.rb', line 41 def version @version end |