class DBus::NodeTree

Has a tree of {Node}s, refering to {Object}s or to {ProxyObject}s.

Attributes

root[R]

@return [Node]

Public Class Methods

new() click to toggle source
   # File lib/dbus/node_tree.rb
18 def initialize
19   @root = Node.new("/")
20 end

Public Instance Methods

get_node(path, create: false) click to toggle source

Get the object node corresponding to the given path. @param path [ObjectPath] @param create [Boolean] if true, the the {Node}s in the path are created

if they do not already exist.

@return [Node,nil]

   # File lib/dbus/node_tree.rb
27 def get_node(path, create: false)
28   n = @root
29   path.sub(%r{^/}, "").split("/").each do |elem|
30     if !(n[elem])
31       return nil if !create
32 
33       n[elem] = Node.new(elem)
34     end
35     n = n[elem]
36   end
37   n
38 end