Module: Kernel

Defined in:
lib/weewar-ai/__dir__.rb

Overview

Extensions for Kernel

Instance Method Summary collapse

Instance Method Details

#__DIR__Object

This is similar to __FILE__ and __LINE__, and returns a String representing the directory of the current file is. Unlike __FILE__ the path returned is absolute.

This method is convenience for the

File.expand_path(File.dirname(__FILE__))

idiom.



18
19
20
21
# File 'lib/weewar-ai/__dir__.rb', line 18

def __DIR__()
  filename = caller[0][/^(.*):/, 1]
  File.expand_path(File.dirname(filename))
end