inclusion 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/inclusion/inclusion.rb +7 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 26016a50fa13dc345d3e462f7a92b680b198053f
|
4
|
+
data.tar.gz: da5afcb3dae1c4e498baa90c85752cc62a4837c8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ae5fdff9dd45003ebe32b7c3f326c965168228138dd0e4a5087892f9ec936dbb4f1a96eb786c9d385d539499e015be724185429b3b5764ba08f7012c6f3304ec
|
7
|
+
data.tar.gz: 465858ad6e792c48d98b60ab71555faf946ed8db7f1f91da4c207251c390d6e1b6e4dbab44a4a677dadce5694c0b0ba6aadacb865b3c72f79710fb5ebd93d72b
|
data/lib/inclusion/inclusion.rb
CHANGED
@@ -1,18 +1,20 @@
|
|
1
1
|
class Inclusion
|
2
2
|
attr_reader :obj
|
3
3
|
attr_reader :inclusion_names
|
4
|
+
attr_reader :search_ancestors
|
4
5
|
|
5
6
|
def obj_const
|
6
7
|
@obj_const ||= ([Module, Class].include?(obj.class) ? obj : obj.class)
|
7
8
|
end
|
8
9
|
|
9
|
-
def initialize(obj, inclusion_names)
|
10
|
+
def initialize(obj, inclusion_names, search_ancestors: false)
|
10
11
|
@obj = obj
|
11
12
|
@inclusion_names = inclusion_names
|
13
|
+
@search_ancestors = search_ancestors
|
12
14
|
end
|
13
15
|
|
14
|
-
def self.!(obj, *inclusion_names)
|
15
|
-
new(obj, inclusion_names).!
|
16
|
+
def self.!(obj, *inclusion_names, search_ancestors: false)
|
17
|
+
new(obj, inclusion_names, search_ancestors: search_ancestors).!
|
16
18
|
end
|
17
19
|
|
18
20
|
def !
|
@@ -65,10 +67,10 @@ class Inclusion
|
|
65
67
|
end
|
66
68
|
|
67
69
|
def includion_mod(mod, inner)
|
68
|
-
mod.const_get(inner, search_ancestors
|
70
|
+
mod.const_get(inner, search_ancestors)
|
69
71
|
end
|
70
72
|
|
71
73
|
def inclusion_defined?(mod, inner)
|
72
|
-
mod.const_defined?(inner, search_ancestors
|
74
|
+
mod.const_defined?(inner, search_ancestors)
|
73
75
|
end
|
74
76
|
end
|