Event based parsing of a YAML stream with JRuby in 1.8 mode

Hi all!

Has anyone a suggestion on how to do event based parsing of a YAML
stream with JRuby in 1.8 mode?


With kind regards
Uwe K.
Kubosch Consulting
[email protected]

On 2011-05-04, at 16:05, Uwe K. wrote:

Has anyone a suggestion on how to do event based parsing of a YAML stream with
JRuby in 1.8 mode?

How can I access Psyck in JRuby in 1.8 mode?


With kind regards
Uwe K.
Kubosch Consulting
[email protected]

Looks like it’s guarded to only be loadable by ‘require “psych”’ in
1.9 mode, but you could try this:

require 'jruby'
require 'rbconfig'
Java::org.jruby.ext.psych.PsychLibrary.new.load(JRuby.runtime, 

false)
$LOADED_FEATURES << ‘psych.so’
$LOAD_PATH << File.join(Config::CONFIG[‘libdir’], ‘ruby/1.9’)
require ‘psych.rb’
handler = Psych::Handler.new
parser = Psych::Parser.new(handler)
# override methods on handler
def handler.scalar(*args) p(args) end
parser.parse($stdin)
# etc. etc.

/Nick

Thanks!

Now to get it working in Ruboto…

On 2011-05-04, at 20:55, Nick S. wrote:

parser = Psych::Parser.new(handler)

Has anyone a suggestion on how to do event based parsing of a YAML stream with
JRuby in 1.8 mode?


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email


With kind regards
Uwe K.
Kubosch Consulting
[email protected]

Got it working on Ruboto as well.

On 2011-05-04, at 22:46, Uwe K. wrote:

require ‘rbconfig’

With kind regards

http://xircles.codehaus.org/manage_email


With kind regards
Uwe K.
Kubosch Consulting
[email protected]