public Method

Stat.mode

stat.mode    fixnum

Returns an integer representing the permission bits of stat. The meaning of the bits is platform dependent; on Unix systems, see stat(2).

File.chmod(0644, "testfile")   #=> 1
s = File.stat("testfile")
sprintf("%o", s.mode)          #=> "100644"

Source Code

/*
*  call-seq:
*     stat.mode   => fixnum
*  
*  Returns an integer representing the permission bits of
*  <i>stat</i>. The meaning of the bits is platform dependent; on
*  Unix systems, see <code>stat(2)</code>.
*     
*     File.chmod(0644, "testfile")   #=> 1
*     s = File.stat("testfile")
*     sprintf("%o", s.mode)          #=> "100644"
*/

static VALUE
rb_stat_mode(self)
   VALUE self;
{
#ifdef __BORLANDC__
   return UINT2NUM((unsigned short)(get_stat(self)->st_mode));
#else
   return UINT2NUM(get_stat(self)->st_mode);
#endif
}
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.