/usr/lib/ruby/1.8/ramaze/snippets/object/__dir__.rb is in libramaze-ruby1.8 2010.06.18-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | # Copyright (c) 2008 Michael Fellinger m.fellinger@gmail.com
# All files in this distribution are subject to the terms of the Ruby license.
module Ramaze
module CoreExtensions
# Extensions for Object
module Object
unless defined?(__DIR__)
# 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.
def __DIR__(*args)
filename = caller[0][/^(.*):/, 1]
dir = File.expand_path(File.dirname(filename))
::File.expand_path(::File.join(dir, *args.map{|a| a.to_s}))
end
end
end
end
end
|