Class: DBus::Signal
- Inherits:
-
InterfaceElement
- Object
- InterfaceElement
- DBus::Signal
- Defined in:
- lib/dbus/introspect.rb
Overview
D-Bus interface signal class
This is a class representing signals that are part of an interface.
Instance Attribute Summary
Attributes inherited from InterfaceElement
Instance Method Summary collapse
-
#from_prototype(prototype) ⇒ Object
Add parameter types based on the given prototype.
-
#to_xml ⇒ Object
Return an XML string representation of the signal interface elment.
Methods inherited from InterfaceElement
#add_fparam, #add_param, #initialize, #validate_name
Constructor Details
This class inherits a constructor from DBus::InterfaceElement
Instance Method Details
#from_prototype(prototype) ⇒ Object
Add parameter types based on the given prototype.
193 194 195 196 197 198 199 200 201 202 203 204 |
# 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 ⇒ Object
Return an XML string representation of the signal interface elment.
207 208 209 210 211 212 213 214 215 |
# File 'lib/dbus/introspect.rb', line 207 def to_xml xml = %(<signal name="#{@name}">\n) @params.each do |param| name = param.name ? %(name="#{param.name}" ) : "" xml += %(<arg #{name}type="#{param.type}"/>\n) end xml += %(</signal>\n) xml end |