class DBus::ProxyObjectFactory

D-Bus proxy object factory class

Class that generates and sets up a proxy object based on introspection data.

Public Class Methods

introspect_into(pobj, xml) click to toggle source

Investigates the sub-nodes of the proxy object pobj based on the introspection XML data xml and sets them up recursively. @param pobj [ProxyObject] @param xml [String]

   # File lib/dbus/proxy_object_factory.rb
31 def self.introspect_into(pobj, xml)
32   # intfs [Array<Interface>], subnodes [Array<String>]
33   intfs, pobj.subnodes = IntrospectXMLParser.new(xml).parse
34   intfs.each do |i|
35     poi = ProxyObjectInterface.new(pobj, i.name)
36     i.methods.each_value { |m| poi.define(m) }
37     i.signals.each_value { |s| poi.define(s) }
38     i.properties.each_value { |p| poi.define(p) }
39     pobj[i.name] = poi
40   end
41   pobj.introspected = true
42 end
new(xml, bus, dest, path, api: ApiOptions::CURRENT) click to toggle source

Creates a new proxy object factory for the given introspection XML xml, bus, destination dest, and path.

   # File lib/dbus/proxy_object_factory.rb
19 def initialize(xml, bus, dest, path, api: ApiOptions::CURRENT)
20   @xml = xml
21   @bus = bus
22   @path = path
23   @dest = dest
24   @api = api
25 end

Public Instance Methods

build() click to toggle source

Generates, sets up and returns the proxy object.

   # File lib/dbus/proxy_object_factory.rb
45 def build
46   po = ProxyObject.new(@bus, @dest, @path, api: @api)
47   ProxyObjectFactory.introspect_into(po, @xml)
48   po
49 end