APIdock / Ruby
/
method

blockdev?

ruby latest stable - Class: File
blockdev?(p1)
public

Returns true if the named file is a block device.

file_name can be an IO object.

static VALUE
rb_file_blockdev_p(VALUE obj, VALUE fname)
{
#ifndef S_ISBLK
# ifdef S_IFBLK
# define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
# else
# define S_ISBLK(m) (0) /* anytime false */
# endif
#endif
#ifdef S_ISBLK
 struct stat st;
 if (rb_stat(fname, &st) < 0) return Qfalse;
 if (S_ISBLK(st.st_mode)) return Qtrue;
#endif
 return Qfalse;
}

AltStyle によって変換されたページ (->オリジナル) /