Source:
private String runLiquid( final String templateSource, final Map<String, Object> templateParams, final String templateIncludePath) { final ScriptingContainerDelegate localJRubyContainer = LazyScriptingContainerDelegate.withGems(rootLogger, this.embulkSystemProperties); localJRubyContainer.runScriptlet("require 'liquid'"); localJRubyContainer.put("__internal_liquid_template_source__", templateSource); localJRubyContainer.runScriptlet("template = Liquid::Template.parse(__internal_liquid_template_source__, :error_mode => :strict)"); localJRubyContainer.remove("__internal_liquid_template_source__"); if (templateIncludePath != null) { localJRubyContainer.put("__internal_liquid_template_include_path_java__", templateIncludePath); localJRubyContainer.runScriptlet("__internal_liquid_template_include_path__ = File.expand_path(__internal_liquid_template_include_path_java__ || File.dirname(config)) unless __internal_liquid_template_include_path_java__ == false"); localJRubyContainer.runScriptlet("template.registers[:file_system] = Liquid::LocalFileSystem.new(__internal_liquid_template_include_path__, \"_%s.yml.liquid\")"); localJRubyContainer.remove("__internal_liquid_template_include_path__"); } localJRubyContainer.put("__internal_liquid_template_params__", templateParams); localJRubyContainer.runScriptlet("__internal_liquid_template_data__ = { 'env' => ENV.to_h }.merge(__internal_liquid_template_params__)"); localJRubyContainer.remove("__internal_liquid_template_params__"); final Object renderedObject = localJRubyContainer.runScriptlet("template.render(__internal_liquid_template_data__)"); return renderedObject.toString(); }

Target:
private String runLiquid( final String templateSource, final Map<String, Object> templateParams, final String templateIncludePath) throws IOException { final ScriptingContainerDelegate localJRubyContainer = LazyScriptingContainerDelegate.withGems(rootLogger, this.embulkSystemProperties); if (localJRubyContainer == null) { throw new IOException("JRuby is not configured well to run Liquid. Configure the Embulk system property \"jruby\"."); } localJRubyContainer.runScriptlet("require 'liquid'"); localJRubyContainer.put("__internal_liquid_template_source__", templateSource); localJRubyContainer.runScriptlet("template = Liquid::Template.parse(__internal_liquid_template_source__, :error_mode => :strict)"); localJRubyContainer.remove("__internal_liquid_template_source__"); if (templateIncludePath != null) { localJRubyContainer.put("__internal_liquid_template_include_path_java__", templateIncludePath); localJRubyContainer.runScriptlet("__internal_liquid_template_include_path__ = File.expand_path(__internal_liquid_template_include_path_java__ || File.dirname(config)) unless __internal_liquid_template_include_path_java__ == false"); localJRubyContainer.runScriptlet("template.registers[:file_system] = Liquid::LocalFileSystem.new(__internal_liquid_template_include_path__, \"_%s.yml.liquid\")"); localJRubyContainer.remove("__internal_liquid_template_include_path__"); } localJRubyContainer.put("__internal_liquid_template_params__", templateParams); localJRubyContainer.runScriptlet("__internal_liquid_template_data__ = { 'env' => ENV.to_h }.merge(__internal_liquid_template_params__)"); localJRubyContainer.remove("__internal_liquid_template_params__"); final Object renderedObject = localJRubyContainer.runScriptlet("template.render(__internal_liquid_template_data__)"); return renderedObject.toString(); }