Class: MooTool::Models::DeviceTree
- Inherits:
-
Object
- Object
- MooTool::Models::DeviceTree
- Defined in:
- lib/mootool/models/device_tree.rb
Defined Under Namespace
Constant Summary collapse
- NODE_FORMAT =
'VV'- PROP_FORMAT =
'A32V'- PHANDLE_PROP =
'AAPL,phandle'- COMPATIBLE_PROP =
'compatible'
Instance Attribute Summary collapse
-
#root ⇒ Object
readonly
Returns the value of attribute root.
Class Method Summary collapse
Instance Method Summary collapse
- #add_handle(node, handle) ⇒ Object
-
#initialize(data) ⇒ DeviceTree
constructor
A new instance of DeviceTree.
- #to_h ⇒ Object
Constructor Details
#initialize(data) ⇒ DeviceTree
Returns a new instance of DeviceTree.
80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/mootool/models/device_tree.rb', line 80 def initialize(data) @handles = {} case data when Pathname @data = File.open(data.realpath, 'rb') when String @data = StringIO.new(data) when IO @data = data when MooTool::Models::Decompressor @data = StringIO.new data.data end @root = Node.new(self, @data) end |
Instance Attribute Details
#root ⇒ Object (readonly)
Returns the value of attribute root.
77 78 79 |
# File 'lib/mootool/models/device_tree.rb', line 77 def root @root end |
Class Method Details
.load(path) ⇒ Object
99 100 101 |
# File 'lib/mootool/models/device_tree.rb', line 99 def self.load(path) MooTool::Models::DeviceTree.new(Pathname.new(path)) end |
Instance Method Details
#add_handle(node, handle) ⇒ Object
95 96 97 |
# File 'lib/mootool/models/device_tree.rb', line 95 def add_handle(node, handle) @handles[handle] = node end |
#to_h ⇒ Object
103 104 105 |
# File 'lib/mootool/models/device_tree.rb', line 103 def to_h @root.to_h end |