stat.blockdev? → true or false
Returns true if the file is a block device, false if it isn’t or if the operating system doesn’t support this feature.
File.stat("testfile").blockdev? #=> false File.stat("/dev/hda1").blockdev? #=> true
Source Code
/* * call-seq: * stat.blockdev? => true or false * * Returns <code>true</code> if the file is a block device, * <code>false</code> if it isn't or if the operating system doesn't * support this feature. * * File.stat("testfile").blockdev? #=> false * File.stat("/dev/hda1").blockdev? #=> true * */ static VALUE rb_stat_b(obj) VALUE obj; { #ifdef S_ISBLK if (S_ISBLK(get_stat(obj)->st_mode)) return Qtrue; #endif return Qfalse; }
<code/>and<pre/>for code samples.