You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: test/markups/README.creole.html
+5-1Lines changed: 5 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,8 @@
1
-
<h1>H1</h1><h2>H2</h2><p>paragraph of text that will be turned into a paragraph element. It can go over several lines with line breaks, it will be turned into a contiguous paragraph element.</p><p>You can force a linebreak in your paragraph text<br/>thusly.</p><ul><li>a list element<ul><li>sub list element</li></ul></li><li>2nd list element</li></ul><pre>pre formatted text
1
+
<h1>H1</h1><h2>H2</h2><p>paragraph of text that will be turned into a paragraph element. It can go over several lines with line breaks, it will be turned into a contiguous paragraph element.</p><p>You can force a linebreak in your paragraph text<br>thusly.</p><ul>
2
+
<li>a list element<ul><li>sub list element</li></ul>
<p><ahref="Home">» JRuby Project Wiki Home Page</a>
3
-
<h1>Embedding JRuby</h1>
1
+
<p><ahref="Home">» JRuby Project Wiki Home Page</a>
2
+
</p><h1>Embedding JRuby</h1>
4
3
Using Java from Ruby is JRuby's best-known feature---but you can also go in the other direction, and use Ruby from Java. There are several different ways to do this. You can execute entire Ruby scripts, call individual Ruby methods, or even implement a Java interface in Ruby (thus allowing you to treat Ruby objects like Java ones). We refer to all these techniques generically as "embedding." This section will explain how to embed JRuby in your Java project.
5
-
</p>
6
-
<p><tableid="toc" class="toc" summary="Contents"><tr><td><divid="toctitle"><h2>Table of Contents</h2></div><ul></li><li><
F438
ahref="#Red_Bridge_JRuby_Embed">Red Bridge (JRuby Embed)</a><ul><li><ahref="#Features_of_Red_Bridge">Features of Red Bridge</a></li></ul><li><ahref="#Previous_Embedding_JRuby_Page">Previous Embedding JRuby Page</a></li><li><ahref="#References">References</a></li></ul></td></tr></table>
<p>JRuby has long had a private embedding API, which was closely tied to the runtime's internals and therefore changed frequently as JRuby evolved. Since version 1.4, however, we have also provided a more stable public API, known as Red Bridge or JRuby Embed. Existing Java programs written to the <ahref="DirectJRubyEmbedding">legacy API</a> should still work, but we strongly recommend Red Bridge for all new projects.
14
23
</p>
15
24
16
-
<h2><aname="Features_of_Red_Bridge"></a><spanclass="mw-headline" id="Features_of_Red_Bridge">Features of Red Bridge</span></h2>
25
+
<h2>
26
+
<aname="Features_of_Red_Bridge"></a>Features of Red Bridge</h2>
17
27
18
28
19
29
<p>Red Bridge consists of two layers: Embed Core on the bottom, and implementations of <ahref="http://www.jcp.org/en/jsr/detail?id=223" target="_blank">JSR223</a> and <ahref="http://jakarta.apache.org/bsf/" target="_blank">BSF</a> on top. Embed Core is JRuby-specific, and can take advantage of much of JRuby's power. JSR223 and BSF are more general interfaces that provide a common ground across scripting languages.
<p><ol><li>With Embed Core, you can create several Ruby environments in one JVM, and configure them individually (via <code>org.jruby.RubyInstanceConfig</code>. With the other APIs, configuration options can only be set globally, via the <code>System</code> properties.</li><li>Embed Core offers several shortcuts, such as loading scripts from a <code>java.io.InputStream</code>, or returning Java-friendly objects from Ruby code. These allow you to skip a lot of boilerplate.</li></ol>
36
+
<p></p><ol>
37
+
<li>With Embed Core, you can create several Ruby environments in one JVM, and configure them individually (via <code>org.jruby.RubyInstanceConfig</code>. With the other APIs, configuration options can only be set globally, via the <code>System</code> properties.</li>
38
+
<li>Embed Core offers several shortcuts, such as loading scripts from a <code>java.io.InputStream</code>, or returning Java-frien
10000
dly objects from Ruby code. These allow you to skip a lot of boilerplate.</li>
39
+
</ol>
27
40
For projects requiring multiple scripting languages, JSR223 is a good fit. Though the API is language-independent, JRuby's implementation of it allows you to set some Ruby-specific options. In particular, you can control the threading model of the scripting engine, the lifetime of local variables, compilation mode, and how line numbers are displayed.
28
-
</p>
41
+
29
42
<p>The full <ahref="http://jruby-embed.kenai.com/docs/" target="_blank">API documentation</a> has all the gory details. It's worth talking about a couple of the finer points here.
<p>We recommend using Embed Core; however, if you're maintaining code that uses the old API, you can find its documentation on the <ahref="JavaIntegration">legacy embedding</a><supclass="reference" id="cite_ref-1-0">[<ahref="#cite_note-1">1</a>]</sup> page.
49
+
<p>We recommend using Embed Core; however, if you're maintaining code that uses the old API, you can find its documentation on the <ahref="JavaIntegration">legacy embedding</a><sup>[<ahref="#cite_note-1">1</a>]</sup> page.
0 commit comments