Class: Pvectl::Models::Base Abstract
- Inherits:
-
Object
- Object
- Pvectl::Models::Base
- Defined in:
- lib/pvectl/models/base.rb,
sig/pvectl/models/base.rbs
Overview
This class is abstract.
Subclass and add attr_readers for domain attributes.
Abstract base class for domain models.
Provides common initialization from hash attributes. All models are immutable - only getters, no setters.
Subclasses store domain data and contain domain logic, but do not fetch data themselves (that's the Repository's job).
Direct Known Subclasses
AptPackage, Backup, Capability, Container, DnsConfig, HostsFile, JournalEntry, NetworkInterface, Node, OperationResult, PhysicalDisk, Service, Snapshot, Storage, Subscription, SyslogEntry, Task, TaskEntry, TaskLogLine, TimeConfig, Vm, Volume
Instance Attribute Summary collapse
-
#attributes ⇒ Hash
readonly
The raw attributes hash.
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ Base
constructor
Creates model from attributes hash.
Constructor Details
#initialize(attributes = {}) ⇒ Base
Creates model from attributes hash.
Converts string keys to symbols for consistent access.
39 40 41 |
# File 'lib/pvectl/models/base.rb', line 39 def initialize(attributes = {}) @attributes = (attributes || {}).transform_keys(&:to_sym) end |
Instance Attribute Details
#attributes ⇒ Hash (readonly)
46 47 48 |
# File 'lib/pvectl/models/base.rb', line 46 def attributes @attributes end |