الفرق بين المراجعتين ل"Ruby/InstructionSequence/base label"

من موسوعة حسوب
اذهب إلى التنقل اذهب إلى البحث
(أنشأ الصفحة ب'<noinclude>{{DISPLAYTITLE: التابع <code>base_label‎</code> الخاص بالصنف <code>InstructionSequence</code> في روبي}}</noinclude> تصنيف:...')
 
ط (مراجعة وتدقيق.)
 
(مراجعة متوسطة واحدة بواسطة مستخدم واحد آخر غير معروضة)
سطر 1: سطر 1:
<noinclude>{{DISPLAYTITLE: التابع <code>base_label‎</code> الخاص بالصنف <code>InstructionSequence</code> في روبي}}</noinclude>
+
<noinclude>{{DISPLAYTITLE: التابع <code>InstructionSequence.base_label‎</code> في روبي}}</noinclude>
 
[[تصنيف: Ruby]]
 
[[تصنيف: Ruby]]
 
[[تصنيف: Ruby Method]]
 
[[تصنيف: Ruby Method]]
 
[[تصنيف: Ruby InstructionSequence]]
 
[[تصنيف: Ruby InstructionSequence]]
يُعيد التابع <code>base_label</code> التسمية الأساسية (base label) ل[[Ruby/InstructionSequence|سلسلة التعليمات]] التي التي استُدعي معها.
+
يُعيد التابع <code>base_label</code> التسمية الأساسية (base label) ل[[Ruby/InstructionSequence|سلسلة التعليمات]] التي استُدعي معها.
على سبيل المثال، باستخدام irb:
+
==البنية العامة==
 +
<syntaxhighlight lang="ruby">base_label()</syntaxhighlight>
 +
==القيمة المعادة==
 +
تعاد التسمية الأساسية (base label) ل[[Ruby/InstructionSequence|سلسلة التعليمات]] التي استُدعي معها.
  
أو باستخدام <code>[[Ruby/InstructionSequence/compile_file|::compile_file]]</code>:
+
==أمثلة==
<syntaxhighlight lang="ruby"># /tmp/method.rb
+
مثال على استخدام التابع <code>base_label‎</code>:
 +
<syntaxhighlight lang="ruby">iseq = RubyVM::InstructionSequence.compile('num = 1 + 2')
 +
#=> <RubyVM::InstructionSequence:<compiled>@<compiled>>
 +
iseq.base_label
 +
#=> "<compiled>"‎</syntaxhighlight>مثال آخر على استعمال التابع <code>base_label‎</code> مع استخدام التابع <code>[[Ruby/InstructionSequence/compile_file|compile_file]]</code>:<syntaxhighlight lang="ruby"># /tmp/method.rb
 
def hello
 
def hello
 
   puts "hello, world"
 
   puts "hello, world"
سطر 14: سطر 21:
 
> iseq = RubyVM::InstructionSequence.compile_file('/tmp/method.rb')
 
> iseq = RubyVM::InstructionSequence.compile_file('/tmp/method.rb')
 
> iseq.base_label #=> <main>‎</syntaxhighlight>
 
> iseq.base_label #=> <main>‎</syntaxhighlight>
==البنية العامة==
+
==انظر أيضًا==
<syntaxhighlight lang="ruby">‎</syntaxhighlight>
+
* التابع <code>[[Ruby/InstructionSequence/absolute_path|absolute_path]]</code>: يُعيد المسار المطلق ل[[Ruby/InstructionSequence|سلسلة التعليمات]] المعطاة.
==القيمة المُعادة==
 
 
 
==أمثلة==
 
مثال على استخدام التابع <code>base_label‎</code>:
 
<syntaxhighlight lang="ruby">iseq = RubyVM::InstructionSequence.compile('num = 1 + 2')
 
#=> <RubyVM::InstructionSequence:<compiled>@<compiled>>
 
iseq.base_label
 
#=> "<compiled>"‎</syntaxhighlight>
 
==انظر أيضا==
 
* التابع <code>[[Ruby/InstructionSequence/absolute_path|absolute_path]]</code>: يُعيد المسار المطلق ل[[Ruby/InstructionSequence|سلسلة التعليمات]] (<code>[[Ruby/InstructionSequence|InstructionSequence]]</code>).
 
* التابع <code>[[Ruby/InstructionSequence/disasm|disasm]]</code>: يأخذ  الكائن <code>body</code> ، الذي يمكن أن يكون من النوع (<code>[[Ruby/Method|Method]]</code>) أو من النوع <code>[[Ruby/Proc|Proc]]</code> ، ويعيد سلسلة نصية (<code>[[Ruby/String|String]]</code>) تحتوي <code>body</code> على هيئة تعليمات قابلة للقراءة.
 
  
 
==مصادر==
 
==مصادر==
*[http://ruby-doc.org/core-2.5.1/RubyVM/InstructionSequence.html#method-i-base_label قسم التابع base_label‎ في الصنف InstructionSequence‎ في توثيق روبي الرسمي.]
+
*[http://ruby-doc.org/core-2.5.1/RubyVM/InstructionSequence.html#method-i-base_label قسم التابع base_label‎ في الصنف InstructionSequence‎ في توثيق روبي الرسمي.]

المراجعة الحالية بتاريخ 07:24، 4 ديسمبر 2018

يُعيد التابع base_label التسمية الأساسية (base label) لسلسلة التعليمات التي استُدعي معها.

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

base_label()

القيمة المعادة

تعاد التسمية الأساسية (base label) لسلسلة التعليمات التي استُدعي معها.

أمثلة

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

iseq = RubyVM::InstructionSequence.compile('num = 1 + 2')
#=> <RubyVM::InstructionSequence:<compiled>@<compiled>>
iseq.base_label
#=> "<compiled>"‎

مثال آخر على استعمال التابع base_label‎ مع استخدام التابع compile_file:

# /tmp/method.rb
def hello
  puts "hello, world"
end
# in irb
> iseq = RubyVM::InstructionSequence.compile_file('/tmp/method.rb')
> iseq.base_label #=> <main>‎

انظر أيضًا

مصادر