Class: DBus::ObjectPath
- Inherits:
-
String
- Object
- String
- DBus::ObjectPath
- Defined in:
- lib/dbus/object_path.rb
Overview
A String that validates at initialization time
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(s) ⇒ ObjectPath
constructor
A new instance of ObjectPath.
Constructor Details
#initialize(s) ⇒ ObjectPath
Returns a new instance of ObjectPath.
13 14 15 16 17 18 |
# File 'lib/dbus/object_path.rb', line 13 def initialize(s) unless self.class.valid?(s) raise DBus::Error, "Invalid object path #{s.inspect}" end super end |
Class Method Details
.valid?(s) ⇒ Boolean
20 21 22 |
# File 'lib/dbus/object_path.rb', line 20 def self.valid?(s) s == "/" || s =~ %r{\A(/[A-Za-z0-9_]+)+\z} end |