class_dependencies 0.4.3 → 0.5.0
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/Rakefile +1 -1
- data/VERSION +1 -1
- data/lib/class_dependencies.rb +2 -1
- data/spec/class_dependencies_spec.rb +16 -0
- metadata +6 -6
data/Rakefile
CHANGED
@@ -10,7 +10,7 @@ begin
|
|
10
10
|
gem.email = "craig@trampolinesystems.com"
|
11
11
|
gem.homepage = "http://github.com/trampoline/class_dependencies"
|
12
12
|
gem.authors = ["mccraig mccraig of the clan mccraig"]
|
13
|
-
gem.add_development_dependency "rspec", ">= 1.2.
|
13
|
+
gem.add_development_dependency "rspec", ">= 1.2.8"
|
14
14
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
15
15
|
end
|
16
16
|
Jeweler::GemcutterTasks.new
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.5.0
|
data/lib/class_dependencies.rb
CHANGED
@@ -73,11 +73,12 @@ module ClassDependencies
|
|
73
73
|
# if there is already such a method, alias it
|
74
74
|
if mod.respond_to?(method_name)
|
75
75
|
aliased_method_name = "class_dependencies_#{method_name}"
|
76
|
+
raise "can't include ClassDependencies twice" if mod.respond_to?(aliased_method_name)
|
76
77
|
mc.send(:alias_method, aliased_method_name, method_name)
|
77
78
|
end
|
78
79
|
|
79
80
|
mc.send(:define_method, method_name) do |mod2|
|
80
|
-
raise "include #{mod.to_s} on a Class... doesn't work with intermediate modules" if ! mod2.is_a? Class
|
81
|
+
# raise "include #{mod.to_s} on a Class... doesn't work with intermediate modules" if ! mod2.is_a? Class
|
81
82
|
mod.descendants << class_to_sym(mod2)
|
82
83
|
mod2.instance_eval do
|
83
84
|
mc2 = class << self ; include ClassDependencies::ClassName ; self ; end
|
@@ -129,4 +129,20 @@ describe "ClassDependencies" do
|
|
129
129
|
it "should return all dependencies even without relationships" do
|
130
130
|
Foo.ordered_dependencies.to_set.should == Set.new([:k,:l])
|
131
131
|
end
|
132
|
+
|
133
|
+
module Woo
|
134
|
+
include ClassDependencies
|
135
|
+
end
|
136
|
+
|
137
|
+
module M
|
138
|
+
include Woo
|
139
|
+
end
|
140
|
+
|
141
|
+
module N
|
142
|
+
include Woo
|
143
|
+
end
|
144
|
+
|
145
|
+
it "should work with modules too" do
|
146
|
+
Woo.descendants.to_set.should == Set.new([:n, :m])
|
147
|
+
end
|
132
148
|
end
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
-
-
|
8
|
-
-
|
9
|
-
version: 0.
|
7
|
+
- 5
|
8
|
+
- 0
|
9
|
+
version: 0.5.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- mccraig mccraig of the clan mccraig
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-05-13 00:00:00 +01:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -27,8 +27,8 @@ dependencies:
|
|
27
27
|
segments:
|
28
28
|
- 1
|
29
29
|
- 2
|
30
|
-
-
|
31
|
-
version: 1.2.
|
30
|
+
- 8
|
31
|
+
version: 1.2.8
|
32
32
|
type: :development
|
33
33
|
version_requirements: *id001
|
34
34
|
description: easily declare and query dependencies amongst Ruby classes
|