### Home Classes Methods

### In Files

- lib/dbus/introspect.rb

### Parent

Object

### Methods

- ::new
- #<<
- #define
- #define_method
- #validate_name

### Files

- README

### Class/Module Index

Quicksearch

- DBus
- DBus::ASessionBus
- DBus::ASystemBus
- DBus::AuthenticationFailed
- DBus::Authenticator
- DBus::Client
- DBus::Connection
- DBus::Connection::NameRequestError
- DBus::DBusCookieSHA1
- DBus::Error
- DBus::ErrorMessage
- DBus::External
- DBus::FormalParameter
- DBus::IncompleteBufferException
- DBus::Interface
- DBus::InterfaceElement
- DBus::IntrospectXMLParser
- DBus::InvalidClassDefinition
- DBus::InvalidDestinationName
- DBus::InvalidIntrospectionData
- DBus::InvalidMethodName
- DBus::InvalidPacketException
- DBus::InvalidParameters
- DBus::Main
- DBus::MatchRule
- DBus::MatchRuleException
- DBus::Message
- DBus::Method
- DBus::MethodNotImplemented
- DBus::MethodReturnMessage
- DBus::Node
- DBus::Object
- DBus::Object::UndefinedInterface
- DBus::PacketMarshaller
- DBus::PacketUnmarshaller
- DBus::ProxyObject
- DBus::ProxyObjectFactory
- DBus::ProxyObjectInterface
- DBus::RemoteBus
- DBus::Service
- DBus::SessionBus
- DBus::Signal
- DBus::SystemBus
- DBus::Type
- DBus::Type::Parser
- DBus::Type::SignatureException
- DBus::Type::Type
- DBus::TypeException
- DBus::UnknownSignal
- Integer

No matching classes.

# DBus::Interface

# D-Bus interface class

This class is the interface descriptor. In most cases, the Introspect() method call instantiates and configures this class for us.

It also is the local definition of interface exported by the program. At the client side, see ProxyObjectInterface

### Attributes

methods[R]

The methods that are part of the interface. Hash: Symbol => DBus::Method

name[R]

The name of the interface. String

signals[R]

The signals that are part of the interface. Hash: Symbol => Signal

### Public Class Methods

new(name) click to toggle source

Creates a new interface with a given name.

    # File lib/dbus/introspect.rb, line 44
    def initialize(name)
      validate_name(name)
      @name = name
      @methods, @signals = Hash.new, Hash.new
    end

### Public Instance Methods

<<(m) click to toggle source
Alias for: define
define(m) click to toggle source

Helper method for defining a method m.

    # File lib/dbus/introspect.rb, line 62
    def define(m)
      if m.kind_of?(Method)
        @methods[m.name.to_sym] = m
      elsif m.kind_of?(Signal)
        @signals[m.name.to_sym] = m
      end
    end

Also aliased as: <<
define_method(id, prototype) click to toggle source

Defines a method with name id and a given prototype in the interface.

    # File lib/dbus/introspect.rb, line 73
    def define_method(id, prototype)
      m = Method.new(id)
      m.from_prototype(prototype)
      define(m)
    end

validate_name(name) click to toggle source

Validates a service name.

    # File lib/dbus/introspect.rb, line 51
    def validate_name(name)
      raise InvalidIntrospectionData if name.bytesize > 255
      raise InvalidIntrospectionData if name =~ /^\./ or name =~ /\.$/
      raise InvalidIntrospectionData if name =~ /\.\./
      raise InvalidIntrospectionData if not name =~ /\./
      name.split(".").each do |element|
        raise InvalidIntrospectionData if not element =~ InterfaceElementRE
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.