Class: Hackmac::OC
- Inherits:
-
Object
- Object
- Hackmac::OC
- Defined in:
- lib/hackmac/oc.rb
Overview
A class that represents an OpenCore configuration and provides access to its remote version information
The OC class encapsulates the functionality for working with OpenCore bootloader configurations, including retrieving remote release information from GitHub sources and providing access to version metadata for comparison and upgrade operations
Instance Method Summary collapse
-
#initialize(config:) ⇒ OC
constructor
The initialize method sets up an OC instance by storing the provided configuration object.
-
#inspect ⇒ String
The inspect method returns a string representation of the object that includes its class name and string value.
-
#name ⇒ String?
The name method retrieves the name attribute from the remote source object.
-
#remote ⇒ Hackmac::GithubSource?
The remote method retrieves or creates a remote source object for OpenCore.
-
#to_s ⇒ String
The to_s method returns a string representation of the object by combining its name and version attributes into a single space-separated string.
-
#version ⇒ Tins::StringVersion, ...
The version method retrieves the version identifier from the remote kext source.
Constructor Details
#initialize(config:) ⇒ OC
The initialize method sets up an OC instance by storing the provided configuration object.
This method takes a configuration object and assigns it to an instance variable for later use in accessing OC-related settings and source information.
23 24 25 |
# File 'lib/hackmac/oc.rb', line 23 def initialize(config:) @config = config end |
Instance Method Details
#inspect ⇒ String
The inspect method returns a string representation of the object that includes its class name and string value.
88 89 90 |
# File 'lib/hackmac/oc.rb', line 88 def inspect "#<#{self.class}: #{to_s}>" end |
#name ⇒ String?
The name method retrieves the name attribute from the remote source object
This method accesses the cached remote source object and returns its name information if available. It uses the safe navigation operator to avoid errors when the remote source has not been initialized
64 65 66 |
# File 'lib/hackmac/oc.rb', line 64 def name remote.name end |
#remote ⇒ Hackmac::GithubSource?
The remote method retrieves or creates a remote source object for OpenCore
This method manages the initialization and caching of a remote source object that provides access to OpenCore release information from GitHub. It constructs the appropriate source configuration including authentication credentials and version suffix based on debug settings, then creates a GithubSource instance to handle communication with the GitHub API for retrieving release data
41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/hackmac/oc.rb', line 41 def remote @remote and return @remote source = @config.oc.source github = source.github auth = [ @config.github.user, @config.github.access_token ].compact auth.empty? and auth = nil suffix = case debug = source.debug? when true then 'DEBUG' when false then 'RELEASE' when nil then nil end @remote = Hackmac::GithubSource.new(github, auth: auth, suffix: suffix) end |
#to_s ⇒ String
The to_s method returns a string representation of the object by combining its name and version attributes into a single space-separated string.
98 99 100 |
# File 'lib/hackmac/oc.rb', line 98 def to_s "#{name} #{version}" end |
#version ⇒ Tins::StringVersion, ...
The version method retrieves the version identifier from the remote kext source
This method accesses the cached remote kext source object and returns its version information if available. It serves as a delegate to the remote_kext’s version attribute, providing convenient access to the latest version data for the kext
79 80 81 |
# File 'lib/hackmac/oc.rb', line 79 def version remote.version end |