summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkares <self@kares.org>2018-06-22 10:59:17 +0200
committerSHIBATA Hiroshi <hsbt@ruby-lang.org>2018-09-28 10:27:41 +0900
commit3e106b8460592a875a9d8611d9e3375e974f4868 (patch)
treed86365a2ede7de118b12156c63c4351b6275824c
parent79f927154da3dbbc30ce21a190b93463e5f0c205 (diff)
downloadpsych-3e106b8460592a875a9d8611d9e3375e974f4868.tar.gz
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>
-rw-r--r--lib/psych.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/psych.rb b/lib/psych.rb
index a728dd7..0f69033 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"