Sha256: b677024a200da61fb616529a411c2a8c66b0968e75ff773d494e02132acd2654

Contents?: true

Size: 1.54 KB

Versions: 111

Compression:

Stored size: 1.54 KB

Contents

/*
 * This code is copyrighted work by Daniel Luz <dev at mernen dot com>.
 *
 * Distributed under the Ruby license: https://www.ruby-lang.org/en/about/license.txt
 */
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

111 entries across 101 versions & 19 rubygems

Version Path
tdiary-5.1.2 vendor/bundle/ruby/2.6.0/gems/json-2.2.0/java/src/json/ext/GeneratorService.java
talon_one-2.0.0 vendor/bundle/ruby/2.3.0/gems/json-2.3.0/java/src/json/ext/GeneratorService.java
cloudsmith-api-0.49.118 vendor/bundle/ruby/2.6.0/gems/json-2.3.0/java/src/json/ext/GeneratorService.java
cloudsmith-api-0.49.98 vendor/bundle/ruby/2.6.0/gems/json-2.3.0/java/src/json/ext/GeneratorService.java
cloudsmith-api-0.49.94 vendor/bundle/ruby/2.6.0/gems/json-2.3.0/java/src/json/ext/GeneratorService.java
json_pure-2.3.0 java/src/json/ext/GeneratorService.java
tdiary-5.1.1 vendor/bundle/ruby/2.6.0/gems/json-2.2.0/java/src/json/ext/GeneratorService.java
cloudsmith-api-0.49.21 vendor/bundle/ruby/2.6.0/gems/json-2.3.0/java/src/json/ext/GeneratorService.java
cloudsmith-api-0.49.15 vendor/bundle/ruby/2.6.0/gems/json-2.3.0/java/src/json/ext/GeneratorService.java
cloudsmith-api-0.49.13 vendor/bundle/ruby/2.6.0/gems/json-2.3.0/java/src/json/ext/GeneratorService.java
cloudsmith-api-0.49.9 vendor/bundle/ruby/2.3.0/gems/json-2.3.0/java/src/json/ext/GeneratorService.java
grape-extra_validators-1.0.0 vendor/bundle/ruby/2.4.0/gems/json-2.3.0/java/src/json/ext/GeneratorService.java
json-2.3.0 java/src/json/ext/GeneratorService.java
zuora_connect_ui-0.10.0 vendor/ruby/2.6.0/gems/json-2.2.0/java/src/json/ext/GeneratorService.java
tdiary-5.1.0 vendor/bundle/gems/json-2.2.0/java/src/json/ext/GeneratorService.java
zuora_connect_ui-0.9.2 vendor/ruby/2.6.0/gems/json-2.2.0/java/src/json/ext/GeneratorService.java
zuora_connect_ui-0.9.1 vendor/ruby/2.6.0/gems/json-2.2.0/java/src/json/ext/GeneratorService.java
zuora_connect_ui-0.9.0 vendor/ruby/2.6.0/gems/json-2.2.0/java/src/json/ext/GeneratorService.java
cloudsmith-api-0.44.4 vendor/bundle/ruby/2.3.0/gems/json-2.2.0/java/src/json/ext/GeneratorService.java
zuora_connect_ui-0.8.3 vendor/ruby/2.6.0/gems/json-2.2.0/java/src/json/ext/GeneratorService.java