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, line 18
def initialize
  @root = Node.new("/")
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, line 27
def get_node(path, create: false)
  n = @root
  path.sub(%r{^/}, "").split("/").each do |elem|
    if !(n[elem])
      return nil if !create

      n[elem] = Node.new(elem)
    end
    n = n[elem]
  end
  n
end