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