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

من موسوعة حسوب
اذهب إلى التنقل اذهب إلى البحث
(أنشأ الصفحة ب'<noinclude>{{DISPLAYTITLE: التابع <code>base_label‎</code> الخاص بالصنف <code>InstructionSequence</code> في روبي}}</noinclude> تصنيف:...')
 
سطر 3: سطر 3:
 
[[تصنيف: 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:
 
  
أو باستخدام <code>[[Ruby/InstructionSequence/compile_file|::compile_file]]</code>:
+
على سبيل المثال، باستخدام irb:<syntaxhighlight lang="ruby">iseq = RubyVM::InstructionSequence.compile('num = 1 + 2')
<syntaxhighlight lang="ruby"># /tmp/method.rb
+
#=> <RubyVM::InstructionSequence:<compiled>@<compiled>>
 +
iseq.base_label
 +
#=> "<compiled>"</syntaxhighlight>
 +
أو باستخدام التابع <code>[[Ruby/InstructionSequence/compile_file|compile_file]]</code>:<syntaxhighlight lang="ruby"># /tmp/method.rb
 
def hello
 
def hello
 
   puts "hello, world"
 
   puts "hello, world"
سطر 15: سطر 17:
 
> iseq.base_label #=> <main>‎</syntaxhighlight>
 
> iseq.base_label #=> <main>‎</syntaxhighlight>
 
==البنية العامة==
 
==البنية العامة==
<syntaxhighlight lang="ruby"></syntaxhighlight>
+
<syntaxhighlight lang="ruby">base_label()</syntaxhighlight>
 
==القيمة المُعادة==
 
==القيمة المُعادة==
 +
يُعيد التابع <code>base_label</code> التسمية الأساسية (base label) ل[[Ruby/InstructionSequence|سلسلة التعليمات]] التي استُدعي معها.
  
 
==أمثلة==
 
==أمثلة==
سطر 25: سطر 28:
 
#=> "<compiled>"‎</syntaxhighlight>
 
#=> "<compiled>"‎</syntaxhighlight>
 
==انظر أيضا==
 
==انظر أيضا==
* التابع <code>[[Ruby/InstructionSequence/absolute_path|absolute_path]]</code>: يُعيد  المسار المطلق ل[[Ruby/InstructionSequence|سلسلة التعليمات]] (<code>[[Ruby/InstructionSequence|InstructionSequence]]</code>).
+
* التابع <code>[[Ruby/InstructionSequence/absolute_path|absolute_path]]</code>: يُعيد  المسار المطلق ل[[Ruby/InstructionSequence|سلسلة التعليمات]].
* التابع <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‎ في توثيق روبي الرسمي.]

مراجعة 22:09، 1 نوفمبر 2018

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

على سبيل المثال، باستخدام irb:

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

أو باستخدام التابع 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>‎

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

base_label()

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

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

أمثلة

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

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

انظر أيضا

مصادر