Skip to content
Lyndon wraps JavaScript in a loving MacRuby embrace. A fun hack that is no longer maintained.
Ruby JavaScript
Find file
New pull request
Latest commit a3fa1f6 @defunkt output to STDOUT and exit successfully
MacRuby has a tendency to blurt out SIMBL-related errors (for example)
on STDERR, so outputting to STDOUT makes it easier to distinguish (as
well as to capture output). [mojodna]
Failed to load latest commit information.
bin output to STDOUT and exit successfully
examples Update README and example
lib Add Version module
LICENSE first pass
README.markdown Update README and example
Rakefile Jewelerize Lyndon



Lyndon is like Johnson. But for MacRuby. And with JavaScriptCore.

Here It Goes

$ rip install git://
Successfully installed lyndon (41548d2)
$ lyndon
js> 1 + 1
=> 2
js> function name() { return "lyndon!" }
=> undefined
js> name
=> function name() { return "lyndon!" }
js> name()
=> "lyndon!"
js> Ruby.puts('Ruby, I presume.')
Ruby, I presume.
=> undefined
js> Ruby.File_read('hi.js')
=> "// this is hi.js\n"

Stuff like that.

Oh, the DOM

$ lyndon test.html 
js> Lyndon.require('jquery.min.js')
=> true
js> jQuery('#hi').html()
=> "Hello."
js> jQuery('#hi').html('Hi.')
=> [object Object]
js> jQuery('#hi').html()
=> "Hi."
=> "[object HTMLBodyElement]"
js> document.body.innerHTML
=> "\n    <h1 id=\"hi\">Hi.</h1>\n  \n\n"

HTML with JavaScript

$ cat examples/index.html | lyndon
<title>It worked!</title>
<div id="content">
<div id="hi">Hello world!</div></div>

Note that the <div id="hi">Hello world!</div></div> does not exist in examples/index.html - it's added at runtime by JavaScript. JavaScript that strips itself out and changes the <title>.


With Ruby

If you want:

$ macirb
>> require 'lyndon'
=> true
>> Lyndon.eval('1 + 1')
=> 2
>> r =
=> ##-<Lyndon::Runtime:...>
>> r.eval('var name = "chris"')
=> undefined
>> r.eval('name')
=> "chris"

That's basically it.

Chris Wanstrath //

Something went wrong with that request. Please try again.