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