@@ -33,6 +33,8 @@ class ProxyObject
33
33
# @return [ApiOptions]
34
34
attr_reader :api
35
35
36
+ OPEN_QUOTE = RUBY_VERSION >= "3.4" ? "'" : "`"
37
+
36
38
# Creates a new proxy object living on the given _bus_ at destination _dest_
37
39
# on the given _path_.
38
40
def initialize ( bus , dest , path , api : ApiOptions ::CURRENT )
@@ -58,7 +60,7 @@ def interfaces
58
60
def []( intfname )
59
61
introspect unless introspected
60
62
ifc = @interfaces [ intfname ]
61
- raise DBus ::Error , "no such interface ` #{ intfname } ' on object ` #{ @path } '" unless ifc
63
+ raise DBus ::Error , "no such interface #{ OPEN_QUOTE } #{ intfname } ' on object #{ OPEN_QUOTE } #{ @path } '" unless ifc
62
64
63
65
ifc
64
66
end
@@ -127,7 +129,8 @@ def has_iface?(name)
127
129
# @return [void]
128
130
def on_signal ( name , &block )
129
131
unless @default_iface && has_iface? ( @default_iface )
130
- raise NoMethodError , "undefined signal `#{ name } ' for DBus interface `#{ @default_iface } ' on object `#{ @path } '"
132
+ raise NoMethodError , "undefined signal #{ OPEN_QUOTE } #{ name } ' for DBus interface " \
133
+ "#{ OPEN_QUOTE } #{ @default_iface } ' on object #{ OPEN_QUOTE } #{ @path } '"
131
134
end
132
135
133
136
@interfaces [ @default_iface ] . on_signal ( name , &block )
@@ -151,18 +154,20 @@ def method_missing(name, *args, &reply_handler)
151
154
# - di not specified
152
155
# TODO
153
156
# - di is specified but not found in introspection data
154
- raise NoMethodError , "undefined method `#{ name } ' for DBus interface `#{ @default_iface } ' on object `#{ @path } '"
157
+ raise NoMethodError , "undefined method #{ OPEN_QUOTE } #{ name } ' for DBus interface " \
158
+ "#{ OPEN_QUOTE } #{ @default_iface } ' on object #{ OPEN_QUOTE } #{ @path } '"
155
159
end
156
160
157
161
begin
158
162
@interfaces [ @default_iface ] . method ( name ) . call ( *args , &reply_handler )
159
163
rescue NameError => e
160
164
# interesting, foo.method("unknown")
161
165
# raises NameError, not NoMethodError
162
- raise unless e . to_s =~ /undefined method ` #{ name } '/
166
+ raise unless e . to_s =~ /undefined method #{ OPEN_QUOTE } #{ name } '/
163
167
164
168
# BTW e.exception("...") would preserve the class.
165
- raise NoMethodError , "undefined method `#{ name } ' for DBus interface `#{ @default_iface } ' on object `#{ @path } '"
169
+ raise NoMethodError , "undefined method #{ OPEN_QUOTE } #{ name } ' for DBus interface " \
170
+ "#{ OPEN_QUOTE } #{ @default_iface } ' on object #{ OPEN_QUOTE } #{ @path } '"
166
171
end
167
172
end
168
173
# rubocop:enable Lint/MissingSuper
0 commit comments