View Javadoc
1   /*
2    * scriptable-dataset (https://github.com/hazendaz/scriptable-dataset)
3    *
4    * Copyright 2011-2023 Hazendaz.
5    *
6    * All rights reserved. This program and the accompanying materials
7    * are made available under the terms of The Apache Software License,
8    * Version 2.0 which accompanies this distribution, and is available at
9    * https://www.apache.org/licenses/LICENSE-2.0.txt
10   *
11   * Contributors:
12   *     Gunnar Morling
13   *     Hazendaz (Jeremy Landis).
14   */
15  package de.gmorling.scriptabledataset.handlers;
16  
17  import javax.script.ScriptEngine;
18  
19  /**
20   * The Class JRubyImportAddingInvocationHandler.
21   */
22  public class JRubyImportAddingInvocationHandler implements ScriptInvocationHandler {
23  
24      @Override
25      public String getLanguageName() {
26          return "jruby";
27      }
28  
29      @Override
30      public String preInvoke(String script) {
31          return "require 'bigdecimal'; require 'bigdecimal/math'; include BigMath; " + script;
32      }
33  
34      @Override
35      public Object postInvoke(Object object) {
36          return object;
37      }
38  
39      @Override
40      public void setScriptEngine(ScriptEngine engine) {
41          // Do nothing
42      }
43  
44  }