Class: MooTool::Models::IOReg
- Inherits:
-
Object
- Object
- MooTool::Models::IOReg
- Defined in:
- lib/mootool/models/io_reg.rb
Defined Under Namespace
Classes: Node
Constant Summary collapse
- MANIFEST_ROOTS =
%i[asmb manifest-properties secure-boot-hashes].freeze
Instance Attribute Summary collapse
-
#manifests ⇒ Object
readonly
Returns the value of attribute manifests.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(device_tree_data) ⇒ IOReg
constructor
A new instance of IOReg.
- #properties_with_hash(hash) ⇒ Object
- #transform_node(node) ⇒ Object
Constructor Details
#initialize(device_tree_data) ⇒ IOReg
Returns a new instance of IOReg.
72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/mootool/models/io_reg.rb', line 72 def initialize(device_tree_data) data = CFPropertyList.native_types CFPropertyList::List.new(data: device_tree_data).value data = data.deep_symbolize_keys @data = transform_node(data) @data.delete :IOConsoleUsers @data.delete :IOKitDiagnostics @entries = @data[:'device-tree'][:chosen] @manifests = @entries[:'manifest-properties'].to_h.merge(@entries[:'secure-boot-hashes'].to_h).merge(@entries[:asmb].to_h).transform_values do |v| v.is_a?(String) ? v.unpack1('H*').upcase : v end end |
Instance Attribute Details
#manifests ⇒ Object (readonly)
Returns the value of attribute manifests.
68 69 70 |
# File 'lib/mootool/models/io_reg.rb', line 68 def manifests @manifests end |
Class Method Details
Instance Method Details
#properties_with_hash(hash) ⇒ Object
86 87 88 |
# File 'lib/mootool/models/io_reg.rb', line 86 def properties_with_hash(hash) @manifests.select { |_key, value| value == hash }.map { |k, _v| k } end |