class DBus::Signal

D-Bus interface signal class

This is a class representing signals that are part of an interface.

Public Instance Methods

from_prototype(prototype) click to toggle source

Add parameter types based on the given prototype.

# File lib/dbus/introspect.rb, line 193
def from_prototype(prototype)
  prototype.split(/, */).each do |arg|
    if arg =~ /:/
      arg = arg.split(":")
      name, sig = arg
    else
      sig = arg
    end
    add_fparam(name, sig)
  end
  self
end
to_xml() click to toggle source

Return an XML string representation of the signal interface elment.

# File lib/dbus/introspect.rb, line 207
def to_xml
  xml = %Q(<signal name="#{@name}">\n)
  @params.each do |param|
    name = param.name ? %Q(name="#{param.name}" ) : ""
    xml += %Q(<arg #{name}type="#{param.type}"/>\n)
  end
  xml += %Q(</signal>\n)
  xml
end