# class DBus::BusName

D-Bus: a name for a connection, like “:1.3” or “org.example.ManagerManager”. Implemented as a {::String} that validates at initialization time. @see dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-names-bus

### Public Class Methods

new(name) click to toggle source

@raise `Error` if not a valid bus name

Calls superclass method

       # File lib/dbus/bus_name.rb
    17 def initialize(name)
    18   unless self.class.valid?(name)
    19     raise DBus::Error, "Invalid bus name #{name.inspect}"
    20   end
    21
    22   super
    23 end

valid?(name) click to toggle source

       # File lib/dbus/bus_name.rb
    25 def self.valid?(name)
    26   name.size <= 255 &&
    27     (name =~ /\A:[A-Za-z0-9_-]+(\.[A-Za-z0-9_-]+)+\z/ ||
    28      name =~ /\A[A-Za-z_-][A-Za-z0-9_-]*(\.[A-Za-z_-][A-Za-z0-9_-]*)+\z/)
    29 end