Sha256: 858d22035d0b4fc161392c873d52400f4a80b84a26fdc0a577ad1615d273f6e6

Contents?: true

Size: 1.54 KB

Versions: 312

Compression:

Stored size: 1.54 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 java.lang.ref.WeakReference;

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::Generator</code> module.
 * @author mernen
 */
public class GeneratorService implements BasicLibraryService {
    public boolean basicLoad(Ruby runtime) throws IOException {
        runtime.getLoadService().require("json/common");
        RuntimeInfo info = RuntimeInfo.initRuntime(runtime);

        info.jsonModule = new WeakReference<RubyModule>(runtime.defineModule("JSON"));
        RubyModule jsonExtModule = info.jsonModule.get().defineModuleUnder("Ext");
        RubyModule generatorModule = jsonExtModule.defineModuleUnder("Generator");

        RubyClass stateClass =
            generatorModule.defineClassUnder("State", runtime.getObject(),
                                             GeneratorState.ALLOCATOR);
        stateClass.defineAnnotatedMethods(GeneratorState.class);
        info.generatorStateClass = new WeakReference<RubyClass>(stateClass);

        RubyModule generatorMethods =
            generatorModule.defineModuleUnder("GeneratorMethods");
        GeneratorMethods.populate(info, generatorMethods);

        return true;
    }
}

Version data entries

312 entries across 272 versions & 47 rubygems

Version Path
scout-5.8.6 vendor/json_pure/java/src/json/ext/GeneratorService.java
scout-5.8.5 vendor/json_pure/java/src/json/ext/GeneratorService.java
scout-5.8.5.pre vendor/json_pure/java/src/json/ext/GeneratorService.java
scout-5.8.4 vendor/json_pure/java/src/json/ext/GeneratorService.java
scout-5.8.3 vendor/json_pure/java/src/json/ext/GeneratorService.java
scout-5.8.1 vendor/json_pure/java/src/json/ext/GeneratorService.java
scout-5.8.0 vendor/json_pure/java/src/json/ext/GeneratorService.java
bundle_depot-0.2.2 fixtures/bundle/json/bde95daa2ce7dede336b4367b9e3a0690027bd6f071e0fdcb1b3047cf988963c/ruby/2.0.0/gems/json_pure-1.8.1/java/src/json/ext/GeneratorService.java
bundle_depot-0.2.1 fixtures/bundle/json/bde95daa2ce7dede336b4367b9e3a0690027bd6f071e0fdcb1b3047cf988963c/ruby/2.0.0/gems/json_pure-1.8.1/java/src/json/ext/GeneratorService.java
bundle_depot-0.2.0 fixtures/bundle/json/bde95daa2ce7dede336b4367b9e3a0690027bd6f071e0fdcb1b3047cf988963c/ruby/2.0.0/gems/json_pure-1.8.1/java/src/json/ext/GeneratorService.java
scout-5.8.0.pre vendor/json_pure/java/src/json/ext/GeneratorService.java
bundle_depot-0.0.3 fixtures/bundle/json/bde95daa2ce7dede336b4367b9e3a0690027bd6f071e0fdcb1b3047cf988963c/ruby/2.0.0/gems/json_pure-1.8.1/java/src/json/ext/GeneratorService.java
bundle_depot-0.0.2 fixtures/bundle/json/bde95daa2ce7dede336b4367b9e3a0690027bd6f071e0fdcb1b3047cf988963c/ruby/2.0.0/gems/json_pure-1.8.1/java/src/json/ext/GeneratorService.java
bundle_depot-0.0.1 fixtures/bundle/json/bde95daa2ce7dede336b4367b9e3a0690027bd6f071e0fdcb1b3047cf988963c/ruby/2.0.0/gems/json_pure-1.8.1/java/src/json/ext/GeneratorService.java
json_pure-1.8.1 java/src/json/ext/GeneratorService.java
json-1.8.1 java/src/json/ext/GeneratorService.java
scout-5.7.5 vendor/json_pure/java/src/json/ext/GeneratorService.java
candlepin-api-0.4.0 bundle/ruby/gems/json-1.7.3/java/src/json/ext/GeneratorService.java
candlepin-api-0.4.0 bundle/ruby/1.9.1/gems/json-1.7.3/java/src/json/ext/GeneratorService.java
candlepin-api-0.4.0 bundle/ruby/1.8/gems/json-1.7.3/java/src/json/ext/GeneratorService.java