Class: DBus::InterfaceElement

Inherits:
Object
  • Object
show all
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.

Direct Known Subclasses

Method, Signal

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ InterfaceElement

Creates a new element with the given name.



97
98
99
100
101
# File 'lib/dbus/introspect.rb', line 97

def initialize(name)
  validate_name(name.to_s)
  @name = name
  @params = Array.new
end

Instance Attribute Details

#nameObject (readonly)

The name of the interface element.



85
86
87
# File 'lib/dbus/introspect.rb', line 85

def name
  @name
end

#paramsObject (readonly)

The parameters of the interface element



87
88
89
# File 'lib/dbus/introspect.rb', line 87

def params
  @params
end

Instance Method Details

#add_param(param) ⇒ Object

Adds a parameter param.



104
105
106
# File 'lib/dbus/introspect.rb', line 104

def add_param(param)
  @params << param
end

#validate_name(name) ⇒ Object

Validates element name.



90
91
92
93
94
# File 'lib/dbus/introspect.rb', line 90

def validate_name(name)
  if (not name =~ MethodSignalRE) or (name.size > 255)
    raise InvalidMethodName
  end
end