doo 0.6.3 → 0.6.4

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.
Files changed (2) hide show
  1. data/lib/doo/base.rb +12 -0
  2. metadata +3 -3
@@ -1,6 +1,7 @@
1
1
  module Doo
2
2
  class Base
3
3
  def load(filename)
4
+ filename = find_file_in_load_path(filename)
4
5
  instance_eval(File.read(filename), filename)
5
6
  end
6
7
 
@@ -37,5 +38,16 @@ module Doo
37
38
  self
38
39
  end
39
40
  end
41
+
42
+ def find_file_in_load_path(file)
43
+ (["/", "."] + $:).each do |path|
44
+ ["", ".rb"].each do |ext|
45
+ name = File.join(path, "#{file}#{ext}")
46
+ return name if File.file?(name)
47
+ end
48
+ end
49
+
50
+ raise LoadError, "no such file to load -- #{file}"
51
+ end
40
52
  end
41
53
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 6
8
- - 3
9
- version: 0.6.3
8
+ - 4
9
+ version: 0.6.4
10
10
  platform: ruby
11
11
  authors:
12
12
  - Mat Trudel
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-03-23 00:00:00 -04:00
17
+ date: 2011-03-25 00:00:00 -04:00
18
18
  default_executable: doo
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency