@Close
  public void close() {
    try {
      JavaEmbedUtils.invokeMethod(
          _ruby, _transformerObject, "close", new Object[0], IRubyObject.class);
    } catch (Exception e) {
      logger.error("Failed to call close() on RubyTransformer", e);
    }

    try {
      JavaEmbedUtils.terminate(_ruby);
    } catch (Exception e) {
      logger.error("Failed to terminate JRuby instance", e);
    }
  }
  /**
   * {@inheritDoc}
   *
   * <p>Latest method of invoking jruby script have been adapted from <a
   * href="http://wiki.jruby.org/wiki/Java_Integration" title="Click to visit JRuby Wiki"> JRuby
   * wiki:</a>
   *
   * @todo create a way to prevent initialization and shutdown with each script invocation.
   */
  protected PicoContainer createContainerFromScript(
      PicoContainer parentContainer, Object assemblyScope) {
    if (parentContainer == null) {
      parentContainer = new EmptyPicoContainer();
    }
    parentContainer =
        new DefaultClassLoadingPicoContainer(
            getClassLoader(), new DefaultPicoContainer(new Caching(), parentContainer));

    RubyInstanceConfig rubyConfig = new RubyInstanceConfig();
    rubyConfig.setLoader(this.getClassLoader());
    Ruby ruby = JavaEmbedUtils.initialize(Collections.EMPTY_LIST, rubyConfig);
    ruby.getLoadService().require("org/picocontainer/script/jruby/scriptedbuilder");
    ruby.defineReadonlyVariable("$parent", JavaEmbedUtils.javaToRuby(ruby, parentContainer));
    ruby.defineReadonlyVariable("$assembly_scope", JavaEmbedUtils.javaToRuby(ruby, assemblyScope));

    try {

      // IRubyObject result = ruby.executeScript(script);
      IRubyObject result = JavaEmbedUtils.newRuntimeAdapter().eval(ruby, script);
      return (PicoContainer) JavaEmbedUtils.rubyToJava(ruby, result, PicoContainer.class);
    } catch (RaiseException re) {
      if (re.getCause() instanceof ScriptedPicoContainerMarkupException) {
        throw (ScriptedPicoContainerMarkupException) re.getCause();
      }
      String message =
          (String) JavaEmbedUtils.rubyToJava(ruby, re.getException().message, String.class);
      if (message.startsWith(MARKUP_EXCEPTION_PREFIX)) {
        throw new ScriptedPicoContainerMarkupException(
            message.substring(MARKUP_EXCEPTION_PREFIX.length()));
      } else {
        throw new PicoCompositionException(message, re);
      }
    } finally {
      JavaEmbedUtils.terminate(ruby);
    }
  }