Class: DBus::InterfaceElement
- Inherits:
-
Object
- Object
- DBus::InterfaceElement
- Defined in:
- lib/dbus/introspect.rb
Overview
D-Bus interface element class
This is a generic class for entities that are part of the interface such as methods and signals.
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
The name of the interface element.
-
#params ⇒ Object
readonly
The parameters of the interface element.
Instance Method Summary collapse
-
#add_fparam(name, signature) ⇒ Object
Adds a formal parameter with name and signature (See also Message#add_param which takes signature+value).
-
#add_param(name_signature_pair) ⇒ Object
Deprecated, for backward compatibility.
-
#initialize(name) ⇒ InterfaceElement
constructor
Creates a new element with the given name.
-
#validate_name(name) ⇒ Object
Validates element name.
Constructor Details
#initialize(name) ⇒ InterfaceElement
Creates a new element with the given name.
116 117 118 119 120 |
# File 'lib/dbus/introspect.rb', line 116 def initialize(name) validate_name(name.to_s) @name = name @params = Array.new end |
Instance Attribute Details
#name ⇒ Object (readonly)
The name of the interface element.
104 105 106 |
# File 'lib/dbus/introspect.rb', line 104 def name @name end |
#params ⇒ Object (readonly)
The parameters of the interface element
106 107 108 |
# File 'lib/dbus/introspect.rb', line 106 def params @params end |
Instance Method Details
#add_fparam(name, signature) ⇒ Object
Adds a formal parameter with name and signature (See also Message#add_param which takes signature+value)
124 125 126 |
# File 'lib/dbus/introspect.rb', line 124 def add_fparam(name, signature) @params << FormalParameter.new(name, signature) end |
#add_param(name_signature_pair) ⇒ Object
Deprecated, for backward compatibility
129 130 131 |
# File 'lib/dbus/introspect.rb', line 129 def add_param(name_signature_pair) add_fparam(*name_signature_pair) end |
#validate_name(name) ⇒ Object
Validates element name.
109 110 111 112 113 |
# File 'lib/dbus/introspect.rb', line 109 def validate_name(name) if (not name =~ MethodSignalRE) or (name.size > 255) raise InvalidMethodName, name end end |