summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorkares <self@kares.org>2018-06-22 10:59:17 +0200
committerCharles Oliver Nutter <headius@headius.com>2018-09-19 11:25:48 -0500
commit52b6548e9cb6ee463a5e25f2db54aae5a0662a81 (patch)
tree56f919028c369ecc652932a2b514f9bc6c688d61 /lib
parent8ff855f61f2f1d9e4adda31eb0a9cc580630ebab (diff)
downloadpsych-52b6548e9cb6ee463a5e25f2db54aae5a0662a81.zip
use newer style of JRuby ext loading when available
to be available since JRuby 9.2.1, avoids Java self-reflecting Signed-off-by: Charles Oliver Nutter <headius@headius.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/psych.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/psych.rb b/lib/psych.rb
index 9ae133d..0f58298 100644
--- a/lib/psych.rb
+++ b/lib/psych.rb
@@ -3,7 +3,12 @@ require 'psych/versions'
case RUBY_ENGINE
when 'jruby'
require 'psych_jars'
- org.jruby.ext.psych.PsychLibrary.new.load(JRuby.runtime, false)
+ if JRuby::Util.respond_to?(:load_ext)
+ JRuby::Util.load_ext('org.jruby.ext.psych.PsychLibrary')
+ else
+ require 'java'; require 'jruby'
+ org.jruby.ext.psych.PsychLibrary.new.load(JRuby.runtime, false)
+ end
else
begin
require "#{RUBY_VERSION[/\d+\.\d+/]}/psych.so"