الصنف NoMethodError
في روبي
< Ruby
اذهب إلى التنقل
اذهب إلى البحث
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
يُطلق الاستثناء NoMethodError
عند استدعاء تابعٍ مع مستقبِل (receiver) غير مُعرَّف فيه مع فشل الاستجابة للتابع method_missing
.
"hello".to_ary
سيُطلق الاستثناء NoMethodError
عند تنيفذ الشيفرة السابقة بالشكل:
NoMethodError: undefined method `to_ary' for "hello":String
توابع الصنف العامة (Public Class Methods)
new
ينشئ استثناءً من النوع NoMethodError
للتابع ذي الاسم المعطى مع الوسائط المُمرَّرة.
توابع النسخة العامة (Public Instance Methods)
args
يعيد الوسائط التي تم تمريرها كمعامل ثالث إلى الباني new
.