class Component::AbstractComponent
Inherited class No implementations.
Attributes
Headers is being used to refer to the subclass-specific file prefixes and suffixes, which are merged with the indices to generate a full filename to be read from on each update.
Files associated with the object Items of that type
Headers is being used to refer to the subclass-specific file prefixes and suffixes, which are merged with the indices to generate a full filename to be read from on each update.
Files associated with the object Items of that type
Headers is being used to refer to the subclass-specific file prefixes and suffixes, which are merged with the indices to generate a full filename to be read from on each update.
Files associated with the object Items of that type
Public Class Methods
Use the path (should end with 'hwmon/*') to glob all the files by the object type's regex, rg
# File lib/radeonnoise/parts.rb 25 def initialize(rg, path) 26 # Initialize the object variables 27 @current, @prefixes, @path = {}, pfx(rg, index(rg, path)), path.gsub("/*", "") 28 29 # Create a card index for each prefix 30 @prefixes.each { |pref| @current[pref] = {} } 31 update 32 end
Public Instance Methods
Attach regex components to item indices, so they can be used with the specific component items
# File lib/radeonnoise/parts.rb 37 def index(rg, path) 38 Dir.glob(path) 39 .reject { |item| !item.match?(rg) } 40 .collect { |item| item.split("/").last.gsub(/\D/, '').to_sym } 41 end
Generate prefixes
# File lib/radeonnoise/parts.rb 44 def pfx(rg, arr) 45 rg.source.gsub(/\\.*$/, '').then { |pf| 46 arr.collect { |item| "#{pf}#{item}".to_sym }} 47 end
Update the local data Set the values that don't change, permanently
# File lib/radeonnoise/parts.rb 51 def update 52 puts "method 'update' is not implemented for #{self.class}, yet" 53 end