dirge 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +11 -1
- data/VERSION +1 -1
- data/lib/dirge.rb +7 -1
- metadata +1 -1
data/README.rdoc
CHANGED
@@ -2,8 +2,12 @@
|
|
2
2
|
|
3
3
|
==Usage
|
4
4
|
|
5
|
-
require 'dirge'
|
5
|
+
require 'dirge'
|
6
6
|
require_relative '../to_my_file'
|
7
|
+
|
8
|
+
Or, the much simpler notation
|
9
|
+
|
10
|
+
require ~'../to_my_file'
|
7
11
|
|
8
12
|
annnd.
|
9
13
|
|
@@ -11,6 +15,12 @@ annnd.
|
|
11
15
|
autoload_relative :MyConstant, 'my_awesome_class/my_constant'
|
12
16
|
end
|
13
17
|
|
18
|
+
Again, this could be
|
19
|
+
|
20
|
+
class MyAwesomeClass
|
21
|
+
autoload :MyConstant, ~'my_awesome_class/my_constant'
|
22
|
+
end
|
23
|
+
|
14
24
|
All of this is powered by the new function:
|
15
25
|
|
16
26
|
__DIR__
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.2
|
data/lib/dirge.rb
CHANGED
@@ -3,7 +3,7 @@ module Kernel
|
|
3
3
|
called_from ||= caller.first
|
4
4
|
caller_path = called_from[/(.*?(?=:\d))/, 1]
|
5
5
|
caller_path = '.' if caller_path == ''
|
6
|
-
File.dirname(caller_path)
|
6
|
+
File.expand_path(File.dirname(caller_path))
|
7
7
|
end
|
8
8
|
|
9
9
|
def require_relative(path)
|
@@ -16,4 +16,10 @@ class Module
|
|
16
16
|
def self.autoload_relative(name, filename)
|
17
17
|
autoload name, File.join(__DIR__(caller.first), filename)
|
18
18
|
end
|
19
|
+
end
|
20
|
+
|
21
|
+
class String
|
22
|
+
def ~@
|
23
|
+
File.expand_path(File.join(__DIR__(caller.first), self))
|
24
|
+
end
|
19
25
|
end
|