Class: AppleData::IORegClass
- Inherits:
-
Object
- Object
- AppleData::IORegClass
- Defined in:
- lib/apple_data/ioreg.rb
Overview
A single IOKit class
Instance Attribute Summary collapse
-
#description ⇒ Object
Returns the value of attribute description.
-
#known_names ⇒ Object
Returns the value of attribute known_names.
-
#name ⇒ Object
Returns the value of attribute name.
-
#parents ⇒ Object
Returns the value of attribute parents.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(klass_name) ⇒ IORegClass
constructor
A new instance of IORegClass.
- #to_h ⇒ Object
- #user_client? ⇒ Boolean
Constructor Details
#initialize(klass_name) ⇒ IORegClass
Returns a new instance of IORegClass.
27 28 29 30 |
# File 'lib/apple_data/ioreg.rb', line 27 def initialize(klass_name) @name = klass_name @parents = [] end |
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description.
25 26 27 |
# File 'lib/apple_data/ioreg.rb', line 25 def description @description end |
#known_names ⇒ Object
Returns the value of attribute known_names.
25 26 27 |
# File 'lib/apple_data/ioreg.rb', line 25 def known_names @known_names end |
#name ⇒ Object
Returns the value of attribute name.
25 26 27 |
# File 'lib/apple_data/ioreg.rb', line 25 def name @name end |
#parents ⇒ Object
Returns the value of attribute parents.
25 26 27 |
# File 'lib/apple_data/ioreg.rb', line 25 def parents @parents end |
Class Method Details
.for_name(name) ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/apple_data/ioreg.rb', line 32 def self.for_name(name) @instances ||= {} @instances[name] = IORegClass.new name unless @instances.key? name @instances[name] end |
.load_one(hash) ⇒ Object
44 45 46 47 48 49 |
# File 'lib/apple_data/ioreg.rb', line 44 def self.load_one(hash) instance = for_name hash['name'] instance.description = hash['description'] instance.parents = hash['parents'] instance.known_names = (hash['known_names'] || []).sort end |
.values ⇒ Object
40 41 42 |
# File 'lib/apple_data/ioreg.rb', line 40 def self.values @instances.values.sort_by(&:name) end |
Instance Method Details
#to_h ⇒ Object
51 52 53 |
# File 'lib/apple_data/ioreg.rb', line 51 def to_h { 'name' => @name, 'description' => @description, 'parents' => @parents, 'known_names' => @known_names } end |
#user_client? ⇒ Boolean
55 56 57 |
# File 'lib/apple_data/ioreg.rb', line 55 def user_client? @parents.include? 'IOUserClient' end |