class DBus::Node
Object
path node class¶ ↑
Class
representing a node on an object path.
Attributes
The name of the node. @return [String] the last component of its object path, or “/”
@return [DBus::Object,DBus::ProxyObject,nil]
The D-Bus object contained by the node.
Public Class Methods
Source
# File lib/dbus/bus.rb, line 195 def initialize(name) super() @name = name @object = nil end
Create a new node with a given name.
Calls superclass method
Public Instance Methods
Source
# File lib/dbus/bus.rb, line 239 def descendant_objects children_objects = values.map(&:object).compact descendants = values.map(&:descendant_objects) flat_descendants = descendants.reduce([], &:+) children_objects + flat_descendants end
All objects (not paths) under this path (except itself). @return [Array<DBus::Object>]
Source
# File lib/dbus/bus.rb, line 220 def inspect # Need something here "<DBus::Node #{sub_inspect}>" end
Return inspect information of the node.
Source
# File lib/dbus/bus.rb, line 226 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
Return instance inspect information, used by Node#inspect
.
Source
# File lib/dbus/bus.rb, line 204 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
Return an XML string representation of the node. It is shallow, not recursing into subnodes @param node_opath [String]