hoodwink.d enhanced
RSS
2.0
XHTML
1.0

RedHanded

Ola's Clever Hpricot Hack #

by why in inspect

If you’re running JRuby from trunk, try this:

 $ gem install hpricot --source http://code.whytheluckystiff.net                                                                  
 Select which gem to install for your platform (java)                                                                             
  1. hpricot 0.5.110 (jruby)                                                                                                      
  2. hpricot 0.5.110 (mswin32)                                                                                                    
  3. hpricot 0.5.110 (ruby)                                                                                                       
 > 1                                                                                                                              
 Successfully installed hpricot-0.5.110-jruby                                                                                     
 Installing ri documentation for hpricot-0.5.110-jruby...                                                                         
 Installing RDoc documentation for hpricot-0.5.110-jruby...

But how is this possible given that Hpricot’s parser is written in C?? Because Ragel can generate Java code! Ola goes into it.

said on

That is crazy awesome.

said on

Agreed. Now, if we could only get a crossplatform RubyCLR and Ragel to generate in C#...

said on

I’m just getting in on the ground floor of this JRuby-extension thing myself—I got jruby gems building for ‘concurrent’ (the library from “Five Ways”) this afternoon.

said on

(with help from Ola, naturally)

said on

One question is—long-term, do we want ‘java’ or ‘jruby’ for the JRuby platform name?

said on

java i’d say, you never know when another impl might pop up.

said on

Okay, so, the reason I’m using “jruby” is because the extension relies on libraries under org.jruby.*. See hpricot_scan.java.rl for the truth.

said on DD Mon YYYY at HH:MM

* do fancy stuff in your comment.

PREVIEW PANE