class_dependencies 0.2.0 → 0.2.1

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/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.2.1
@@ -50,9 +50,9 @@ module Sonar
50
50
  mc.send(:define_method, method_name) do |mod2|
51
51
  raise "include #{mod.to_s} on a Class... doesn't work with intermediate modules" if ! mod2.is_a? Class
52
52
  mod.descendants << class_to_sym(mod2)
53
- dep_method_name = class_to_sym(mod)
54
53
  mod2.instance_eval do
55
- mc2 = class << self ; self ; end
54
+ mc2 = class << self ; include Sonar::ClassDependencies::ClassName ; self ; end
55
+ dep_method_name = mod.relationship_name || class_to_sym(mod)
56
56
  mc2.send(:define_method, dep_method_name){|*params| mod.add_dependency(mod2, *params)}
57
57
  end
58
58
  end
@@ -80,6 +80,12 @@ module Sonar
80
80
  module BaseModuleMethods
81
81
  include Sonar::ClassDependencies::ClassName
82
82
 
83
+ attr_reader :relationship_name
84
+
85
+ def set_relationship_name(name)
86
+ @relationship_name = name
87
+ end
88
+
83
89
  def add_dependency(from, to)
84
90
  from_sym = class_to_sym(from)
85
91
  to_sym = class_to_sym(to)
@@ -32,16 +32,18 @@ describe "ClassDependencies" do
32
32
 
33
33
  module AnotherDep
34
34
  include Sonar::ClassDependencies
35
+
36
+ set_relationship_name :depends_on
35
37
  end
36
38
 
37
39
  class D
38
40
  include AnotherDep
39
- another_dep :e
41
+ depends_on :e
40
42
  end
41
43
 
42
44
  class E
43
45
  include AnotherDep
44
- another_dep :f
46
+ depends_on :f
45
47
  end
46
48
 
47
49
  class F
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 0
9
- version: 0.2.0
8
+ - 1
9
+ version: 0.2.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - mccraig mccraig of the clan mccraig