class DBus::Node
Object path node class¶ ↑
Class representing a node on an object path.
Attributes
name[R]
The name of the node. @return [String] the last component of its object path, or “/”
object[RW]
@return [DBus::Object,DBus::ProxyObject,nil]
The D-Bus object contained by the node.
Public Class Methods
new(name)
click to toggle source
Create a new node with a given name.
Calls superclass method
# File lib/dbus/bus.rb, line 194 def initialize(name) super() @name = name @object = nil end
Public Instance Methods
descendant_objects()
click to toggle source
All objects (not paths) under this path (except itself). @return [Array<DBus::Object>]
# File lib/dbus/bus.rb, line 238 def descendant_objects children_objects = values.map(&:object).compact descendants = values.map(&:descendant_objects) flat_descendants = descendants.reduce([], &:+) children_objects + flat_descendants end
inspect()
click to toggle source
Return inspect information of the node.
# File lib/dbus/bus.rb, line 219 def inspect # Need something here "<DBus::Node #{sub_inspect}>" end
sub_inspect()
click to toggle source
Return instance inspect information, used by #inspect.
# File lib/dbus/bus.rb, line 225 def sub_inspect s = "" if !@object.nil? s += format("%x ", @object.object_id) end contents_sub_inspect = keys .map { |k| "#{k} => #{self[k].sub_inspect}" } .join(",") "#{s}{#{contents_sub_inspect}}" end
to_xml(node_opath)
click to toggle source
Return an XML string representation of the node. It is shallow, not recursing into subnodes @param node_opath [String]
# File lib/dbus/bus.rb, line 203 def to_xml(node_opath) xml = '<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"> ' xml += "<node name=\"#{node_opath}\">\n" each_key do |k| xml += " <node name=\"#{k}\" />\n" end @object&.intfs&.each_value do |v| xml += v.to_xml end xml += "</node>" xml end