Method: Kernel#__dir__
- Defined in:
- eval.c
permalink #__dir__ ⇒ String
Returns the canonicalized absolute path of the directory of the file from which this method is called. It means symlinks in the path is resolved. If __FILE__
is nil
, it returns nil
. The return value equals to File.dirname(File.realpath(__FILE__))
.
2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 |
# File 'eval.c', line 2010
static VALUE
f_current_dirname(VALUE _)
{
VALUE base = rb_current_realfilepath();
if (NIL_P(base)) {
return Qnil;
}
base = rb_file_dirname(base);
return base;
}
|