@@ -226,7 +226,7 @@ def self.rb_to_float(val, meth)
226
226
end
227
227
228
228
def self . conversion_mismatch ( val , cls , meth , res )
229
- raise TypeError , "can't convert #{ val . class } to #{ cls } (#{ val . class } ##{ meth } gives #{ res . class } )"
229
+ raise TypeError , "can't convert #{ object_class ( val ) } to #{ cls } (#{ object_class ( val ) } ##{ meth } gives #{ object_class ( res ) } )"
230
230
end
231
231
232
232
def self . fits_into_int? ( val )
@@ -277,7 +277,7 @@ def self.rb_check_convert_type(obj, cls, meth)
277
277
v = convert_type ( obj , cls , meth , false )
278
278
return nil if v . nil?
279
279
unless object_kind_of? ( v , cls )
280
- raise TypeError , "can't convert #{ obj . class } to #{ cls } (#{ obj . class } ##{ meth } gives #{ v . class } )"
280
+ raise TypeError , "can't convert #{ object_class ( obj ) } to #{ cls } (#{ object_class ( obj ) } ##{ meth } gives #{ object_class ( v ) } )"
281
281
end
282
282
v
283
283
end
@@ -286,14 +286,14 @@ def self.rb_convert_type(obj, cls, meth)
286
286
return obj if object_kind_of? ( obj , cls )
287
287
v = convert_type ( obj , cls , meth , true )
288
288
unless object_kind_of? ( v , cls )
289
- raise TypeError , "can't convert #{ obj . class } to #{ cls } (#{ obj . class } ##{ meth } gives #{ v . class } )"
289
+ raise TypeError , "can't convert #{ object_class ( obj ) } to #{ cls } (#{ object_class ( obj ) } ##{ meth } gives #{ object_class ( v ) } )"
290
290
end
291
291
v
292
292
end
293
293
294
294
def self . rb_check_type ( obj , cls )
295
295
unless object_kind_of? ( obj , cls )
296
- raise TypeError , "wrong argument type #{ obj . class } (expected #{ cls } )"
296
+ raise TypeError , "wrong argument type #{ object_class ( obj ) } (expected #{ cls } )"
297
297
end
298
298
obj
299
299
end
@@ -302,7 +302,7 @@ def self.convert_type(obj, cls, meth, raise_on_error)
302
302
r = check_funcall ( obj , meth )
303
303
if undefined . equal? ( r )
304
304
if raise_on_error
305
- raise TypeError , "can't convert #{ obj . class } into #{ cls } with #{ meth } "
305
+ raise TypeError , "can't convert #{ object_class ( obj ) } into #{ cls } with #{ meth } "
306
306
end
307
307
return nil
308
308
end
@@ -439,7 +439,7 @@ def self.coerce_to_float(obj)
439
439
when nil , true , false
440
440
raise TypeError , "can't convert #{ obj . inspect } into Float"
441
441
else
442
- raise TypeError , "can't convert #{ obj . class } into Float"
442
+ raise TypeError , "can't convert #{ object_class ( obj ) } into Float"
443
443
end
444
444
end
445
445
0 commit comments