dirge 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/README.rdoc +11 -1
  2. data/VERSION +1 -1
  3. data/lib/dirge.rb +7 -1
  4. metadata +1 -1
@@ -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
1
+ 0.0.2
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dirge
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Hull