Skip to content

Commit

Permalink
[Truffle] Basic Kernel#__dir__
Browse files Browse the repository at this point in the history
  • Loading branch information
eregon committed Jul 9, 2015
1 parent c4635e3 commit 5006a23
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 0 additions & 3 deletions spec/truffle/tags/core/kernel/__dir___tags.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
fails:Kernel#__dir__ returns the name of the directory containing the currently-executing file
fails:Kernel#__dir__ when used in eval with top level binding returns the name of the directory containing the currently-executing file
fails:Kernel#__dir__ returns the real name of the directory containing the currently-executing file
fails:Kernel#__dir__ when used in eval with top level binding returns the real name of the directory containing the currently-executing file
6 changes: 6 additions & 0 deletions truffle/src/main/ruby/core/kernel.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@

module Kernel

def __dir__
path = caller_locations(1, 1).first.absolute_path
File.dirname(path)
end
module_function :__dir__

def printf(*args)
print sprintf(*args)
end
Expand Down

0 comments on commit 5006a23

Please sign in to comment.