الفرق بين المراجعتين ل"Ruby/Module/method removed"

من موسوعة حسوب
< Ruby‏ | Module
اذهب إلى التنقل اذهب إلى البحث
ط (مراجعة وتدقيق.)
 
سطر 1: سطر 1:
<noinclude>{{DISPLAYTITLE: التابع <code>method_removed‎</code> الخاص بالصنف <code>Module</code> في روبي}}</noinclude>
+
<noinclude>{{DISPLAYTITLE: التابع <code>Module.method_removed‎</code> في روبي}}</noinclude>
 
[[تصنيف: Ruby]]
 
[[تصنيف: Ruby]]
 
[[تصنيف: Ruby Method]]
 
[[تصنيف: Ruby Method]]
[[تصنيف: Ruby Module]]
+
[[تصنيف: Ruby Module Class]]
 
يستدعى التابع <code>method_removed</code> في كل مرة يُزال تابع نسخة (instance method) من المُستقبِل (receiver).
 
يستدعى التابع <code>method_removed</code> في كل مرة يُزال تابع نسخة (instance method) من المُستقبِل (receiver).
 
==البنية العامة==
 
==البنية العامة==
سطر 22: سطر 22:
 
   end
 
   end
 
   remove_method :some_instance_method
 
   remove_method :some_instance_method
end‎</syntaxhighlight>الناتج:<syntaxhighlight lang="ruby">Removing :some_instance_method
+
end‎</syntaxhighlight>ناتج تنفيذ هذا المثال هو:<syntaxhighlight lang="text">Removing :some_instance_method
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
==انظر أيضا==
 
==انظر أيضا==
* التابع <code>[[Ruby/Module/method_defined-3F|method_defined?‎]]</code>: يعيد  القيمة <code>true</code> إن كان التابع المعطى مُعرّفا في الوحدة أو الصنف.
+
* التابع <code>[[Ruby/Module/method_defined-3F|method_defined?‎]]</code>: يتحقق إن كان التابع المعطى مُعرّفًا في الوحدة أو الصنف.
 
* التابع <code>[[Ruby/Module/method added|method_added]]</code>: يُستدعى في كل مرة يُضاف تابع نسخة (instance method) إلى المُستقبِل (receiver).
 
* التابع <code>[[Ruby/Module/method added|method_added]]</code>: يُستدعى في كل مرة يُضاف تابع نسخة (instance method) إلى المُستقبِل (receiver).
  
 
==مصادر==
 
==مصادر==
*[http://ruby-doc.org/core-2.5.1/Module.html#method-i-method_removed قسم التابع method_removed‎ في الصنف Module‎ في توثيق روبي الرسمي.]
+
*[http://ruby-doc.org/core-2.5.1/Module.html#method-i-method_removed قسم التابع method_removed‎ في الصنف Module‎ في توثيق روبي الرسمي.]

المراجعة الحالية بتاريخ 12:23، 19 نوفمبر 2018

يستدعى التابع method_removed في كل مرة يُزال تابع نسخة (instance method) من المُستقبِل (receiver).

البنية العامة

method_removed(method_name)

المعاملات

method_name‎

اسم تابع النسخة.

أمثلة

مثال على استخدام التابع method_removed‎:

module Chatty
  def self.method_removed(method_name)
    puts "Removing #{method_name.inspect}"
  end
  def self.some_class_method() end
  def some_instance_method() end
  class << self
    remove_method :some_class_method
  end
  remove_method :some_instance_method
end

ناتج تنفيذ هذا المثال هو:

Removing :some_instance_method

انظر أيضا

  • التابع method_defined?‎: يتحقق إن كان التابع المعطى مُعرّفًا في الوحدة أو الصنف.
  • التابع method_added: يُستدعى في كل مرة يُضاف تابع نسخة (instance method) إلى المُستقبِل (receiver).

مصادر