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(po, xml) click to toggle source

Investigates the sub-nodes of the proxy object po based on the introspection XML data xml and sets them up recursively.

   # File lib/dbus/proxy_object_factory.rb
27 def self.introspect_into(po, xml)
28   intfs, po.subnodes = IntrospectXMLParser.new(xml).parse
29   intfs.each do |i|
30     poi = ProxyObjectInterface.new(po, i.name)
31     i.methods.each_value { |m| poi.define(m) }
32     i.signals.each_value { |s| poi.define(s) }
33     po[i.name] = poi
34   end
35   po.introspected = true
36 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
17 def initialize(xml, bus, dest, path, api: ApiOptions::CURRENT)
18   @xml = xml
19   @bus = bus
20   @path = path
21   @dest = dest
22   @api = api
23 end

Public Instance Methods

build() click to toggle source

Generates, sets up and returns the proxy object.

   # File lib/dbus/proxy_object_factory.rb
39 def build
40   po = ProxyObject.new(@bus, @dest, @path, api: @api)
41   ProxyObjectFactory.introspect_into(po, @xml)
42   po
43 end