nested_inherited_jruby_include_package 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a4b59fe4d3ce4b6fb8914041222a663ae9ec827b36aea901615e0c018f79c97a
4
- data.tar.gz: 1aadb2acb8559a97c89fdad1dafe556b1473ce847f550b6137b4330627b99531
3
+ metadata.gz: c3920b3a4d05fffb3446866663dcb68bb37e3758cafefea3e0f6d9f526f4dd46
4
+ data.tar.gz: 128acb0e72ae6b858523b38d0def2213ee2f8b4e98fcdd8ee7601349f84c90a7
5
5
  SHA512:
6
- metadata.gz: 17e2caf99a64dac498e790ead0f7a3bd8e76a66c2e129a8ddcb5c162535321eed1261874febf6df6a85aeda2432e997c3c866a8a03821ca497f0f359e09905a7
7
- data.tar.gz: d05aef862b1251a36c21297db2cfaac55629226bc8fb52573f915486e7a5271692e50f9fae2777d2d7542a643c5f24f4ae30618687aab74b639e4aa9c0f771b3
6
+ metadata.gz: 5f14d9126cbd3719684d687cdc0f6c871872a767f0e5d4a53ffd650a7fa38a51b6ad207fdbdf4bd66eb7dedcd054c7b5e7e0e64a82317398631cd6d0c9201a61
7
+ data.tar.gz: c5c7f0e8e27a79a1bdccd150fcc9ecbcc08f67bba03b9ceb0da04f8bd9efc4c3d0678468a6b4a8bcf2fa7bb3bcede7ee1966822ddb8fb474ba802f758fb22552
data/README.md CHANGED
@@ -41,6 +41,20 @@ SubClass.new
41
41
  # prints #<Java::JavaUtil::Arrays::ArrayList:0x7ce3cb8e>
42
42
  ```
43
43
 
44
+ Example (java inheritance):
45
+
46
+ ```ruby
47
+ module GUI
48
+ include_package 'javax.swing'
49
+ include_package 'java.awt.image' # BufferedImage
50
+ # bellow won't work without accessing BufferedImage before :
51
+ class ShowImage < JFrame
52
+ p BufferedImage.new(10, 20, BufferedImage::TYPE_BYTE_BINARY)
53
+ end
54
+ end
55
+ # prints #<Java::JavaAwtImage::BufferedImage:0x2f112965>
56
+ ```
57
+
44
58
  More examples can be found in:
45
59
 
46
60
  [spec/lib/core/src/main/ruby/jruby/java/core_ext/module_spec.rb](spec/lib/core/src/main/ruby/jruby/java/core_ext/module_spec.rb)
@@ -49,7 +63,7 @@ More examples can be found in:
49
63
 
50
64
  Add the following to `Gemfile`:
51
65
  ```
52
- gem 'nested_inherited_jruby_include_package', '~> 0.2.0'
66
+ gem 'nested_inherited_jruby_include_package', '~> 0.3.0'
53
67
  ```
54
68
 
55
69
  And, then run:
@@ -59,7 +73,7 @@ jruby -S bundle install
59
73
 
60
74
  If you are not using Bundler, run:
61
75
  ```
62
- jruby -S gem install nested_inherited_jruby_include_package -v 0.2.0
76
+ jruby -S gem install nested_inherited_jruby_include_package -v 0.3.0
63
77
  ```
64
78
 
65
79
  Then add this line to your code:
@@ -14,7 +14,7 @@ class Module
14
14
  end,
15
15
 
16
16
  collect_ancestors_namespaces: lambda do |collection, m|
17
- return if collection.include?(m)
17
+ return if m.is_a?(Java::JavaPackage) || collection.include?(m)
18
18
  collection << m
19
19
  result = (m.ancestors + hidden_methods[:namespaces].call(m)[1..-1]).uniq
20
20
  if result.size == 1
@@ -39,6 +39,7 @@ class Module
39
39
  end,
40
40
 
41
41
  java_aliases_from_ancestors_namespaces: lambda do |m|
42
+ return [] if m.is_a?(Java::JavaPackage)
42
43
  m.ancestors.map do |klass|
43
44
  hidden_methods[:java_aliases_from_namespaces].call(klass)
44
45
  end.reverse.reduce({}, :merge)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nested_inherited_jruby_include_package
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Maleh