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

من موسوعة حسوب
اذهب إلى التنقل اذهب إلى البحث
ط (مراجعة وتدقيق.)
 
سطر 1: سطر 1:
 
<noinclude>{{DISPLAYTITLE:الصنف <code>IOError</code> في روبي}}</noinclude>
 
<noinclude>{{DISPLAYTITLE:الصنف <code>IOError</code> في روبي}}</noinclude>
 
[[تصنيف: Ruby]]
 
[[تصنيف: Ruby]]
[[تصنيف: Ruby IOError]]
+
[[تصنيف: Ruby Class]]
يُطلق الاستثناء <code>IOError</code> عند فشل عملية [[Ruby/IO|د/خ]] (IO operation)<syntaxhighlight lang="ruby">
+
[[تصنيف: Ruby Error]]
 +
[[تصنيف: Ruby IO]]
 +
يُطلق الاستثناء <code>IOError</code> عند فشل عملية [[Ruby/IO|إدخال/إخراج]] (IO operation) في روبي.<syntaxhighlight lang="ruby">
 
File.open("/etc/hosts") {|f| f << "example"}
 
File.open("/etc/hosts") {|f| f << "example"}
 
   #=> IOError: not opened for writing
 
   #=> IOError: not opened for writing
سطر 8: سطر 10:
 
File.open("/etc/hosts") {|f| f.close; f.read }
 
File.open("/etc/hosts") {|f| f.close; f.read }
 
   #=> IOError: closed stream
 
   #=> IOError: closed stream
</syntaxhighlight>تذكر أن فشل بعض عمليات [[Ruby/IO|د/خ]] (IO operation) قد يؤدي إلى إطلاق الاستثناءات <code>SystemCallError</code>، وهذه الاستثناءات ليست متفرعة من الصنف <code>IOError</code>.<syntaxhighlight lang="ruby">
+
</syntaxhighlight>تذكر أنَّ فشل بعض عمليات [[Ruby/IO|الإدخال/الإخراج]] قد يؤدي إلى إطلاق الاستثناء <code>[[Ruby/SystemCallError|SystemCallError]]</code>، وهذا الاستثناء ليس متفرع من الصنف <code>IOError</code>.<syntaxhighlight lang="ruby">
 
File.open("does/not/exist")
 
File.open("does/not/exist")
 
   #=> Errno::ENOENT: No such file or directory - does/not/exist
 
   #=> Errno::ENOENT: No such file or directory - does/not/exist
سطر 14: سطر 16:
  
 
==مصادر==
 
==مصادر==
*[http://ruby-doc.org/core-2.5.1/IOError.html قسم  الصنف IOError في توثيق روبي الرسمي.]
+
*[http://ruby-doc.org/core-2.5.1/IOError.html صفحة الصنف IOError في توثيق روبي الرسمي.]

المراجعة الحالية بتاريخ 08:10، 8 ديسمبر 2018

يُطلق الاستثناء IOError عند فشل عملية إدخال/إخراج (IO operation) في روبي.

File.open("/etc/hosts") {|f| f << "example"}
  #=> IOError: not opened for writing

File.open("/etc/hosts") {|f| f.close; f.read }
  #=> IOError: closed stream

تذكر أنَّ فشل بعض عمليات الإدخال/الإخراج قد يؤدي إلى إطلاق الاستثناء SystemCallError، وهذا الاستثناء ليس متفرع من الصنف IOError.

File.open("does/not/exist")
  #=> Errno::ENOENT: No such file or directory - does/not/exist

مصادر