Sha256: 2d5e6cb431a6755a11197119fb25355d2e32de87bd7b5fce7b53b8231a6bcba3

Contents?: true

Size: 620 Bytes

Versions: 3

Compression:

Stored size: 620 Bytes

Contents

#          Copyright (c) 2006 Michael Fellinger m.fellinger@gmail.com
# All files in this distribution are subject to the terms of the Ruby license.

# Extensions for Kernel

module Kernel
  # 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.
  #
  unless defined?__DIR__
    def __DIR__()
      filename = caller[0][/(.*?):/, 1]
      File.expand_path(File.dirname(filename))
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ramaze-0.1.4 lib/ramaze/snippets/kernel/__dir__.rb
ramaze-0.2.0 lib/ramaze/snippets/kernel/__dir__.rb
ramaze-0.2.1 lib/ramaze/snippets/kernel/__dir__.rb