/** * Evaluates a script under the current scope (perhaps the top-level * scope) and returns a result only if a script returns a value. * Right after the parsing, the script is evaluated once. * * @param script is a Ruby script to get run * @return an evaluated result converted to a Java object */ public Object runScriptlet(String script) { EmbedEvalUnit unit = parse(script); return runUnit(unit); }
/** * Evaluates a script under the current scope (perhaps the top-level * scope) and returns a result only if a script returns a value. * Right after the parsing, the script is evaluated once. * * @param script is a Ruby script to get run * @return an evaluated result converted to a Java object */ public Object runScriptlet(String script) { EmbedEvalUnit unit = parse(script); return runUnit(unit); }
/** * Evaluates a script under the current scope (perhaps the top-level * scope) and returns a result only if a script returns a value. * Right after the parsing, the script is evaluated once. * * @param script is a Ruby script to get run * @return an evaluated result converted to a Java object */ public Object runScriptlet(String script) { EmbedEvalUnit unit = parse(script); return runUnit(unit); }
private IRubyObject getMarshal() { if (data.marshal == null) { data.marshal = data.container.parse("Marshal").run(); } return data.marshal; }
/** * Evaluates a script under the current scope (perhaps the top-level * scope) and returns a result only if a script returns a value. * Right after the parsing, the script is evaluated once. * * @param script is a Ruby script to get run * @return an evaluated result converted to a Java object */ public Object runScriptlet(String script) { EmbedEvalUnit unit = parse(script); return runUnit(unit); }
boolean hasParseErrors(StyledTextComp wText) { try { container.parse(wText.getText(), 0); return false; } catch (Exception e) { return true; } }
private IRubyObject getBigDecimal() { if (data.bigDecimal == null) { data.bigDecimal = data.container.parse("require 'bigdecimal'; BigDecimal").run(); } return data.bigDecimal; }
private IRubyObject getIPAddr() { if (data.ipAddr == null) { data.ipAddr = data.container.parse("require 'ipaddr'; IPAddr").run(); } return data.ipAddr; }
/** * Reads a script file from specified path and evaluates it under the current * scope (perhaps the top-level scope) and returns a result only if a script * returns a value. Right after the parsing, the script is evaluated once. * * @param type is one of the types {@link PathType} defines * @param filename is used to read the script from and an information * @return an evaluated result converted to a Java object */ public Object runScriptlet(PathType type, String filename) { EmbedEvalUnit unit = parse(type, filename); return runUnit(unit); }
JRubyCompiledScript(ScriptingContainer container, JRubyEngine engine, String script) { this.container = container; this.engine = engine; Utils.preEval(container, engine.getContext()); unit = container.parse(script); }
JRubyCompiledScript(ScriptingContainer container, JRubyEngine engine, String script) { this.container = container; this.engine = engine; Utils.preEval(container, engine.getContext()); unit = container.parse(script); }
/** * create a new ruby object of the bundler command */ private static Object newScript(final ScriptingContainer scriptingContainer) { IRubyObject runnerClass = scriptingContainer.parse(PathType.CLASSPATH, "nexus/bundle_runner.rb").run(); return scriptingContainer.callMethod(runnerClass, "new", IRubyObject.class); }
JRubyCompiledScript(ScriptingContainer container, JRubyEngine engine, String script) { this.container = container; this.engine = engine; Utils.preEval(container, engine.getContext()); unit = container.parse(script); }
JRubyCompiledScript(ScriptingContainer container, JRubyEngine engine, Reader reader) { this.container = container; this.engine = engine; String filename = System.getProperty(ScriptEngine.FILENAME); Utils.preEval(container, engine.getContext()); unit = container.parse(reader, filename, Utils.getLineNumber(engine.getContext())); }
JRubyCompiledScript(ScriptingContainer container, JRubyEngine engine, Reader reader) { this.container = container; this.engine = engine; String filename = System.getProperty(ScriptEngine.FILENAME); Utils.preEval(container, engine.getContext()); unit = container.parse(reader, filename, Utils.getLineNumber(engine.getContext())); }
JRubyCompiledScript(ScriptingContainer container, JRubyEngine engine, Reader reader) { this.container = container; this.engine = engine; String filename = System.getProperty(ScriptEngine.FILENAME); Utils.preEval(container, engine.getContext()); unit = container.parse(reader, filename, Utils.getLineNumber(engine.getContext())); }
JRubyCompiledScript(ScriptingContainer container, JRubyEngine engine, Reader reader) { this.container = container; this.engine = engine; String filename = System.getProperty(ScriptEngine.FILENAME); Utils.preEval(container, engine.getContext()); unit = container.parse(reader, filename, Utils.getLineNumber(engine.getContext())); }
private IRubyObject createApplication() { // There's a lot you could do here; for now, we just read a rackup file from the classpath, // then build a Rack application based on it. ScriptingContainer container = new ScriptingContainer(); container.put("builder_script", readResource("config.ru")); return container.parse("require 'rack'; Rack::Builder.new_from_string(builder_script)").run(); }