Class: Hackmac::Disks
Overview
A class that provides access to comprehensive disk information by querying macOS’s diskutil command
The Disks class interfaces with the diskutil utility to retrieve detailed information about all disks in the system. It executes system commands to gather plist-formatted data about disk configurations and makes this information available through dynamic method calls for easy access and manipulation.
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(limiter: nil, device: nil) ⇒ Disks
constructor
The initialize method sets up a Disks instance by executing a system command to retrieve comprehensive disk information.
Methods included from Plist
#as_hash, #each, #method_missing, #plist, #to_json
Constructor Details
#initialize(limiter: nil, device: nil) ⇒ Disks
The initialize method sets up a Disks instance by executing a system command to retrieve comprehensive disk information.
This method constructs and runs a shell command using the diskutil utility to fetch detailed information about all disks in the system. It processes the XML output, extends the resulting hash with deep find capabilities, and stores the largest matching result set in the instance variable.
62 63 64 |
# File 'lib/hackmac/disks.rb', line 62 def initialize(limiter: nil, device: nil) plist(*(%w[ diskutil list -plist ] + [ limiter, device ].compact)) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Hackmac::Plist