Sha256: 7480312ee9ee80bfa5b3a9eb0584db557ff035733175163c80a9edd0f1dbe3e0

Contents?: true

Size: 758 Bytes

Versions: 4

Compression:

Stored size: 758 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.

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__()
          filename = caller[0][/^(.*):/, 1]
          File.expand_path(File.dirname(filename))
        end
      end
    end

  end
end

Version data entries

4 entries across 4 versions & 3 rubygems

Version Path
Pistos-ramaze-2008.09 lib/ramaze/snippets/object/__dir__.rb
manveru-ramaze-2008.09 lib/ramaze/snippets/object/__dir__.rb
manveru-ramaze-2008.10 lib/ramaze/snippets/object/__dir__.rb
ramaze-2008.11 lib/ramaze/snippets/object/__dir__.rb