nested_inherited_jruby_include_package 0.1.0 → 0.2.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.
- checksums.yaml +4 -4
- data/README.md +12 -2
- data/lib/core/src/main/ruby/jruby/java/core_ext/module.rb +18 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a4b59fe4d3ce4b6fb8914041222a663ae9ec827b36aea901615e0c018f79c97a
|
4
|
+
data.tar.gz: 1aadb2acb8559a97c89fdad1dafe556b1473ce847f550b6137b4330627b99531
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 17e2caf99a64dac498e790ead0f7a3bd8e76a66c2e129a8ddcb5c162535321eed1261874febf6df6a85aeda2432e997c3c866a8a03821ca497f0f359e09905a7
|
7
|
+
data.tar.gz: d05aef862b1251a36c21297db2cfaac55629226bc8fb52573f915486e7a5271692e50f9fae2777d2d7542a643c5f24f4ae30618687aab74b639e4aa9c0f771b3
|
data/README.md
CHANGED
@@ -49,7 +49,7 @@ More examples can be found in:
|
|
49
49
|
|
50
50
|
Add the following to `Gemfile`:
|
51
51
|
```
|
52
|
-
gem 'nested_inherited_jruby_include_package', '~> 0.
|
52
|
+
gem 'nested_inherited_jruby_include_package', '~> 0.2.0'
|
53
53
|
```
|
54
54
|
|
55
55
|
And, then run:
|
@@ -59,7 +59,13 @@ jruby -S bundle install
|
|
59
59
|
|
60
60
|
If you are not using Bundler, run:
|
61
61
|
```
|
62
|
-
jruby -S gem install nested_inherited_jruby_include_package -v 0.
|
62
|
+
jruby -S gem install nested_inherited_jruby_include_package -v 0.2.0
|
63
|
+
```
|
64
|
+
|
65
|
+
Then add this line to your code:
|
66
|
+
|
67
|
+
```ruby
|
68
|
+
require 'nested_inherited_jruby_include_package'
|
63
69
|
```
|
64
70
|
|
65
71
|
# Caveats
|
@@ -76,6 +82,10 @@ To avoid method and constant pollution in `Module`, the implementation intention
|
|
76
82
|
|
77
83
|
This is an early alpha. It has only been used in a couple of projects. As such, there are no guarantees for its functionality. Please report any issues you might discover when using on your own projects.
|
78
84
|
|
85
|
+
# Change Log
|
86
|
+
|
87
|
+
[CHANGELOG.md](CHANGELOG.md)
|
88
|
+
|
79
89
|
# License
|
80
90
|
|
81
91
|
The MIT License
|
@@ -6,9 +6,24 @@ class Module
|
|
6
6
|
def const_missing(constant)
|
7
7
|
hidden_methods = {
|
8
8
|
included_packages_from_ancestors_namespaces: lambda do |m|
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
collection = []
|
10
|
+
hidden_methods[:collect_ancestors_namespaces].call(collection, m)
|
11
|
+
collection.uniq.map do |klass|
|
12
|
+
hidden_methods[:included_packages].call(klass)
|
13
|
+
end.map(&:to_a).reduce([], :+).uniq
|
14
|
+
end,
|
15
|
+
|
16
|
+
collect_ancestors_namespaces: lambda do |collection, m|
|
17
|
+
return if collection.include?(m)
|
18
|
+
collection << m
|
19
|
+
result = (m.ancestors + hidden_methods[:namespaces].call(m)[1..-1]).uniq
|
20
|
+
if result.size == 1
|
21
|
+
return
|
22
|
+
else
|
23
|
+
result[1..-1].each do |klass|
|
24
|
+
hidden_methods[:collect_ancestors_namespaces].call(collection, klass)
|
25
|
+
end
|
26
|
+
end
|
12
27
|
end,
|
13
28
|
|
14
29
|
included_packages_from_namespaces: lambda do |m|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nested_inherited_jruby_include_package
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Maleh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-04-
|
11
|
+
date: 2020-04-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|