الفرق بين المراجعتين ل"Ruby/InstructionSequence/base label"
< Ruby | InstructionSequence
اذهب إلى التنقل
اذهب إلى البحث
(أنشأ الصفحة ب'<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|سلسلة التعليمات]] التي استُدعي معها. |
− | |||
− | أو باستخدام <code>[[Ruby/InstructionSequence/compile_file| | + | على سبيل المثال، باستخدام 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 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/absolute_path|absolute_path]]</code>: يُعيد المسار المطلق ل[[Ruby/InstructionSequence|سلسلة التعليمات]]. |
− | |||
==مصادر== | ==مصادر== | ||
*[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>"
انظر أيضا
- التابع
absolute_path
: يُعيد المسار المطلق لسلسلة التعليمات.