Sha256: 378cb461099be4ab2e472a5a74f79355528762848b023de013f6c0d8916541d7

Contents?: true

Size: 1.13 KB

Versions: 9

Compression:

Stored size: 1.13 KB

Contents

/*
 * This code is copyrighted work by Daniel Luz <dev at mernen dot com>.
 * 
 * Distributed under the Ruby and GPLv2 licenses; see COPYING and GPL files
 * for details.
 */
package json.ext;

import java.io.IOException;

import org.jruby.Ruby;
import org.jruby.RubyClass;
import org.jruby.RubyModule;
import org.jruby.runtime.load.BasicLibraryService;

/**
 * The service invoked by JRuby's {@link org.jruby.runtime.load.LoadService LoadService}.
 * Defines the <code>JSON::Ext::Parser</code> class.
 * @author mernen
 */
public class ParserService implements BasicLibraryService {
    public boolean basicLoad(Ruby runtime) throws IOException {
        runtime.getLoadService().require("json/common");
        RuntimeInfo info = RuntimeInfo.initRuntime(runtime);

        info.jsonModule = runtime.defineModule("JSON");
        RubyModule jsonExtModule = info.jsonModule.defineModuleUnder("Ext");
        RubyClass parserClass =
            jsonExtModule.defineClassUnder("Parser", runtime.getObject(),
                                           Parser.ALLOCATOR);
        parserClass.defineAnnotatedMethods(Parser.class);
        return true;
    }
}

Version data entries

9 entries across 9 versions & 3 rubygems

Version Path
json_pure-1.5.3 java/src/json/ext/ParserService.java
json-1.5.3 java/src/json/ext/ParserService.java
json-1.5.2 java/src/json/ext/ParserService.java
json_pure-1.5.2 java/src/json/ext/ParserService.java
larsklevan-json-1.5.1 java/src/json/ext/ParserService.java
json_pure-1.5.1 java/src/json/ext/ParserService.java
json-1.5.1 java/src/json/ext/ParserService.java
json_pure-1.5.0 java/src/json/ext/ParserService.java
json-1.5.0 java/src/json/ext/ParserService.java