Sha256: a2e2a8a9e44aa7ff7854712deb4e77b6effcb70eaa4c0db44755c1e18c4eca25
Contents?: true
Size: 738 Bytes
Versions: 6
Compression:
Stored size: 738 Bytes
Contents
# 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 # Extensions for String class String # A convenient way to do File.join # # Example: # 'a' / 'b' # -> 'a/b' # File.dirname(__FILE__) / 'bar' # -> "ramaze/snippets/string/bar" def / obj File.join(self, obj.to_s) end end
Version data entries
6 entries across 6 versions & 2 rubygems