# class DBus::InterfaceElement

# D-Bus interface element class¶ ↑

This is a generic class for entities that are part of the interface such as methods and signals.

### Attributes

name[R]

The name of the interface element. Symbol

params[R]

The parameters of the interface element. Array: FormalParameter

### Public Class Methods

new(name) click to toggle source

Creates a new element with the given name.

    # File lib/dbus/introspect.rb, line 114
    def initialize(name)
      validate_name(name.to_s)
      @name = name
      @params = []
    end

### Public Instance Methods

add_fparam(name, signature) click to toggle source

Adds a formal parameter with name and signature (See also DBus::Message#add_param which takes signature+value)

    # File lib/dbus/introspect.rb, line 122
    def add_fparam(name, signature)
      @params << FormalParameter.new(name, signature)
    end

add_param(name_signature_pair) click to toggle source

Deprecated, for backward compatibility

    # File lib/dbus/introspect.rb, line 127
    def add_param(name_signature_pair)
      add_fparam(*name_signature_pair)
    end

validate_name(name) click to toggle source

Validates element name.

    # File lib/dbus/introspect.rb, line 108
    def validate_name(name)
      return if (name =~ METHOD_SIGNAL_RE) && (name.bytesize <= 255)
      raise InvalidMethodName, name
    end