Class: ThisFile
- Inherits:
-
Object
- Object
- ThisFile
- Defined in:
- lib/thisfile.rb
Overview
Easy to use file relative paths.
( ThisFile / "foo.rb" ).should == File.("../foo,rb", __FILE__ )
Class Method Summary collapse
Class Method Details
./(path) ⇒ Object
28 29 30 |
# File 'lib/thisfile.rb', line 28 def self./ (path) File.( path, File.dirname(ThisFile.__file__(2))) end |
.__file__(n = 0) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/thisfile.rb', line 16 def self.__file__(n=0) begin raise "foo" rescue Exception => e parse_backtrace(e.backtrace)[n] end end |