# 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 115
    def initialize(name)
      validate_name(name.to_s)
      @name = name
      @params = Array.new
    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 123
    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 128
    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)
      if (not name =~ MethodSignalRE) or (name.bytesize > 255)
        raise InvalidMethodName, name
      end
    end