psych 2.2.0 → 2.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,79 +0,0 @@
1
- /***** BEGIN LICENSE BLOCK *****
2
- * Version: EPL 1.0/GPL 2.0/LGPL 2.1
3
- *
4
- * The contents of this file are subject to the Eclipse Public
5
- * License Version 1.0 (the "License"); you may not use this file
6
- * except in compliance with the License. You may obtain a copy of
7
- * the License at http://www.eclipse.org/legal/epl-v10.html
8
- *
9
- * Software distributed under the License is distributed on an "AS
10
- * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
11
- * implied. See the License for the specific language governing
12
- * rights and limitations under the License.
13
- *
14
- * Copyright (C) 2010 Charles O Nutter <headius@headius.com>
15
- *
16
- * Alternatively, the contents of this file may be used under the terms of
17
- * either of the GNU General Public License Version 2 or later (the "GPL"),
18
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
19
- * in which case the provisions of the GPL or the LGPL are applicable instead
20
- * of those above. If you wish to allow use of your version of this file only
21
- * under the terms of either the GPL or the LGPL, and not to allow others to
22
- * use your version of this file under the terms of the EPL, indicate your
23
- * decision by deleting the provisions above and replace them with the notice
24
- * and other provisions required by the GPL or the LGPL. If you do not delete
25
- * the provisions above, a recipient may use your version of this file under
26
- * the terms of any one of the EPL, the GPL or the LGPL.
27
- ***** END LICENSE BLOCK *****/
28
- package org.jruby.ext.psych;
29
-
30
- import org.jruby.Ruby;
31
- import org.jruby.RubyClass;
32
- import org.jruby.RubyModule;
33
- import org.jruby.RubyObject;
34
- import org.jruby.RubyException;
35
- import org.jruby.anno.JRubyMethod;
36
- import org.jruby.exceptions.RaiseException;
37
- import org.jruby.runtime.ThreadContext;
38
- import org.jruby.runtime.builtin.IRubyObject;
39
- import static org.jruby.runtime.Visibility.*;
40
-
41
- public class PsychToRuby {
42
- public static void initPsychToRuby(Ruby runtime, RubyModule psych) {
43
- RubyClass classLoader = runtime.defineClassUnder("ClassLoader", runtime.getObject(), RubyObject.OBJECT_ALLOCATOR, psych);
44
-
45
- RubyModule visitors = runtime.defineModuleUnder("Visitors", psych);
46
- RubyClass visitor = runtime.defineClassUnder("Visitor", runtime.getObject(), runtime.getObject().getAllocator(), visitors);
47
- RubyClass psychToRuby = runtime.defineClassUnder("ToRuby", visitor, RubyObject.OBJECT_ALLOCATOR, visitors);
48
-
49
- psychToRuby.defineAnnotatedMethods(ToRuby.class);
50
- classLoader.defineAnnotatedMethods(ClassLoader.class);
51
- }
52
-
53
- public static class ToRuby {
54
- @JRubyMethod(visibility = PRIVATE)
55
- public static IRubyObject build_exception(ThreadContext context, IRubyObject self, IRubyObject klass, IRubyObject message) {
56
- if (klass instanceof RubyClass) {
57
- IRubyObject exception = ((RubyClass)klass).allocate();
58
- ((RubyException)exception).setMessage(message);
59
- return exception;
60
- } else {
61
- throw context.runtime.newTypeError(klass, context.runtime.getClassClass());
62
- }
63
- }
64
- }
65
-
66
- public static class ClassLoader {
67
- @JRubyMethod(visibility = PRIVATE)
68
- public static IRubyObject path2class(ThreadContext context, IRubyObject self, IRubyObject path) {
69
- try {
70
- return context.runtime.getClassFromPath(path.asJavaString());
71
- } catch (RaiseException re) {
72
- if (re.getException().getMetaClass() == context.runtime.getNameError()) {
73
- throw context.runtime.newArgumentError("undefined class/module " + path);
74
- }
75
- throw re;
76
- }
77
- }
78
- }
79
- }
@@ -1,55 +0,0 @@
1
- /***** BEGIN LICENSE BLOCK *****
2
- * Version: EPL 1.0/GPL 2.0/LGPL 2.1
3
- *
4
- * The contents of this file are subject to the Eclipse Public
5
- * License Version 1.0 (the "License"); you may not use this file
6
- * except in compliance with the License. You may obtain a copy of
7
- * the License at http://www.eclipse.org/legal/epl-v10.html
8
- *
9
- * Software distributed under the License is distributed on an "AS
10
- * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
11
- * implied. See the License for the specific language governing
12
- * rights and limitations under the License.
13
- *
14
- * Copyright (C) 2010 Charles O Nutter <headius@headius.com>
15
- *
16
- * Alternatively, the contents of this file may be used under the terms of
17
- * either of the GNU General Public License Version 2 or later (the "GPL"),
18
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
19
- * in which case the provisions of the GPL or the LGPL are applicable instead
20
- * of those above. If you wish to allow use of your version of this file only
21
- * under the terms of either the GPL or the LGPL, and not to allow others to
22
- * use your version of this file under the terms of the EPL, indicate your
23
- * decision by deleting the provisions above and replace them with the notice
24
- * and other provisions required by the GPL or the LGPL. If you do not delete
25
- * the provisions above, a recipient may use your version of this file under
26
- * the terms of any one of the EPL, the GPL or the LGPL.
27
- ***** END LICENSE BLOCK *****/
28
- package org.jruby.ext.psych;
29
-
30
- import org.jruby.Ruby;
31
- import org.jruby.RubyClass;
32
- import org.jruby.RubyModule;
33
- import org.jruby.RubyObject;
34
- import org.jruby.anno.JRubyMethod;
35
- import org.jruby.runtime.ThreadContext;
36
- import org.jruby.runtime.builtin.IRubyObject;
37
- import static org.jruby.runtime.Visibility.*;
38
-
39
- public class PsychYamlTree {
40
- public static void initPsychYamlTree(Ruby runtime, RubyModule psych) {
41
- RubyModule visitors = (RubyModule)psych.getConstant("Visitors");
42
- RubyClass visitor = (RubyClass)visitors.getConstant("Visitor");
43
- RubyClass psychYamlTree = runtime.defineClassUnder("YAMLTree", visitor, RubyObject.OBJECT_ALLOCATOR, visitors);
44
-
45
- psychYamlTree.defineAnnotatedMethods(PsychYamlTree.class);
46
- }
47
-
48
- @JRubyMethod(visibility = PRIVATE)
49
- public static IRubyObject private_iv_get(ThreadContext context, IRubyObject self, IRubyObject target, IRubyObject prop) {
50
- IRubyObject obj = (IRubyObject)target.getInternalVariables().getInternalVariable(prop.asJavaString());
51
- if (obj == null) obj = context.nil;
52
-
53
- return obj;
54
- }
55
- }
@@ -1,6 +0,0 @@
1
- # frozen_string_literal: false
2
- require 'psych/versions'
3
- require 'psych.jar'
4
-
5
- require 'jar-dependencies'
6
- require_jar('org.yaml', 'snakeyaml', Psych::DEFAULT_SNAKEYAML_VERSION)