# class DBus::BusName

A {::String} that validates at initialization time @see dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-names-bus

### Public Class Methods

new(s) click to toggle source

@raise `Error` if not a valid bus name

Calls superclass method

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

valid?(s) click to toggle source

       # File lib/dbus/bus_name.rb
    21 def self.valid?(s)
    22   s.size <= 255 &&
    23     (s =~ /\A:[A-Za-z0-9_-]+(\.[A-Za-z0-9_-]+)+\z/ ||
    24      s =~ /\A[A-Za-z_-][A-Za-z0-9_-]*(\.[A-Za-z_-][A-Za-z0-9_-]*)+\z/)
    25 end