dependable 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/dependable.rb +26 -30
- data/lib/dependable/version.rb +1 -1
- metadata +3 -3
data/lib/dependable.rb
CHANGED
@@ -1,35 +1,31 @@
|
|
1
1
|
module Dependable
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
load
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
print " (requires: #{thing.dependencies.join(',')})" unless thing.dependencies.empty?
|
29
|
-
puts
|
30
|
-
end
|
3
|
+
def dependencies=(dependencies)
|
4
|
+
raise ArgumentError.new('Dependencies must be enumerable') unless dependencies.kind_of?(Enumerable) # TODO debatable whether this should be here
|
5
|
+
@dependencies = dependencies
|
6
|
+
end
|
7
|
+
|
8
|
+
def dependencies
|
9
|
+
@dependencies || []
|
10
|
+
end
|
11
|
+
|
12
|
+
def load_path(include_self = true)
|
13
|
+
load = []
|
14
|
+
@dependencies.each do |dependency|
|
15
|
+
load.concat dependency.load_path
|
16
|
+
end if @dependencies
|
17
|
+
load << self if include_self
|
18
|
+
load.uniq!
|
19
|
+
load
|
20
|
+
end
|
21
|
+
|
22
|
+
def print_load_path(include_self = true)
|
23
|
+
load = self.load_path(include_self)
|
24
|
+
load.each_with_index do |thing, index|
|
25
|
+
print "#{index + 1}) #{thing}"
|
26
|
+
print " (requires: #{thing.dependencies.join(',')})" unless thing.dependencies.empty?
|
27
|
+
puts
|
31
28
|
end
|
32
|
-
|
33
29
|
end
|
34
|
-
|
30
|
+
|
35
31
|
end
|
data/lib/dependable/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dependable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 3
|
10
|
+
version: 0.0.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- John Crepezzi
|