Sha256: 6528958362f5d080abfbb1959f4893dc091df5701d30e7f3ee20edc670e792c6

Contents?: true

Size: 620 Bytes

Versions: 2

Compression:

Stored size: 620 Bytes

Contents

#          Copyright (c) 2008 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

2 entries across 2 versions & 1 rubygems

Version Path
ramaze-0.3.0 lib/ramaze/snippets/kernel/__dir__.rb
ramaze-0.3.5 lib/ramaze/snippets/kernel/__dir__.rb