الفرق بين المراجعتين ل"Ruby/NoMethodError"

من موسوعة حسوب
اذهب إلى التنقل اذهب إلى البحث
ط (مراجعة وتدقيق.)
 
سطر 1: سطر 1:
يُطلق الاستثناء <code>NoMethodError</code> عند استدعاء تابع على مستقبِل (receiver) غير معرف فيه مع فشل الاستجابة للتابع <code>method_missing</code>.<syntaxhighlight lang="ruby">
+
يُطلق الاستثناء <code>NoMethodError</code> عند استدعاء تابعٍ مع مستقبِل (receiver) غير مُعرَّف فيه مع فشل الاستجابة للتابع <code>[[Ruby/BasicObject/method missing|method_missing]]</code>.<syntaxhighlight lang="ruby">
 
"hello".to_ary
 
"hello".to_ary
  
</syntaxhighlight>سيُطلق الاستثناء:<syntaxhighlight lang="ruby">
+
</syntaxhighlight>سيُطلق الاستثناء <code>NoMethodError</code> عند تنيفذ الشيفرة السابقة بالشكل:<syntaxhighlight lang="text">
 
NoMethodError: undefined method `to_ary' for "hello":String
 
NoMethodError: undefined method `to_ary' for "hello":String
  
سطر 8: سطر 8:
  
 
==توابع الصنف العامة (Public Class Methods)==
 
==توابع الصنف العامة (Public Class Methods)==
===[[Ruby/NoMethodError/new | التابع new]]===
+
===[[Ruby/NoMethodError/new | <code>new</code>]]===
ينشئ استثناء <code>NoMethodError</code> للتابع ذي الاسم المعطى مع الوسائط الممررة.
+
ينشئ استثناءً من النوع <code>NoMethodError</code> للتابع ذي الاسم المعطى مع الوسائط المُمرَّرة.
  
 
== توابع النسخة العامة (Public Instance Methods) ==
 
== توابع النسخة العامة (Public Instance Methods) ==
  
===[[Ruby/NoMethodError/args | التابع args]]===
+
===[[Ruby/NoMethodError/args | <code>args</code>]]===
يعيد الوسائط التي تم تمريرها كمعامل ثالث إلى المنشئ.
+
يعيد الوسائط التي تم تمريرها كمعامل ثالث إلى الباني [[Ruby/NoMethodError/new |<code>new</code>]].
 +
 
 +
=== <code>[[Ruby/NoMethodError/private call-3F|?private_call]]</code> ===
 +
 
 
==مصادر<span> </span>==
 
==مصادر<span> </span>==
*[http://ruby-doc.org/core-2.5.1/NoMethodError.html قسم الصنف NoMethodErrorفي توثيق روبي الرسمي.]
+
*[http://ruby-doc.org/core-2.5.1/NoMethodError.html قسم الصنف NoMethodErrorفي توثيق روبي الرسمي.]
<noinclude>{{DISPLAYTITLE: صفحة الصنف <code>NoMethodError</code> في روبي}}</noinclude>
+
<noinclude>{{DISPLAYTITLE:الصنف <code>NoMethodError</code> في روبي}}</noinclude>
 
[[تصنيف: Ruby]]
 
[[تصنيف: Ruby]]
 +
[[تصنيف: Ruby Class]]
 +
[[تصنيف: Ruby Error]]
 
[[تصنيف: Ruby NoMethodError]]
 
[[تصنيف: Ruby NoMethodError]]

المراجعة الحالية بتاريخ 16:15، 20 نوفمبر 2018

يُطلق الاستثناء 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.

?private_call

مصادر