Forum: Ruby Jruby yaml load issue with floats?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
561319f16a08e221a31d13f4419a7de4?d=identicon&s=25 Pradeep Gatram (pradeepgatram)
on 2009-02-20 13:45
(Received via mailing list)
Try this with both MRI and Jruby 1.1.6 (with active support 2.2.2)

irb(main):004:0> require 'rubygems'
=> true
irb(main):005:0> require 'activesupport'
=> true
irb(main):006:0> YAML.load(YAML.dump(3.0)).eql?(3.0)
=> true

MRI returns true, while JRuby returns false !!!

The root cause is that JRuby is loading the yaml as
irb(main):021:0> YAML.load(YAML.dump(3.0))
=> #<YAML::PrivateType:0x18ad9a0 @value="3.0", @type_id="tag:yaml.org,
2002:float:Float">

instead of as 3.0

Has any bug been logged for this? I would have gone ahead and logged
it, but I am unable to register on codehaus :(. For some wierd reason,
I just can't get thru their capta!!! (another bug???).

Would be great if someone could log this one as a bug or point me to
an already logged bug or otherwise explain this behaviour.

Pradeep
Ede2aa10c6462f1d825143879be59e38?d=identicon&s=25 Charles Oliver Nutter (Guest)
on 2009-02-20 17:08
(Received via mailing list)
Pradeep Gatram wrote:
>
> The root cause is that JRuby is loading the yaml as
> irb(main):021:0> YAML.load(YAML.dump(3.0))
> => #<YAML::PrivateType:0x18ad9a0 @value="3.0", @type_id="tag:yaml.org,
> 2002:float:Float">
>
> instead of as 3.0

This should be fixed on trunk/1.2. Can you test out a nightly build?

http://jruby.headius.com:8080/hudson/job/jruby-dist/

- Charlie
561319f16a08e221a31d13f4419a7de4?d=identicon&s=25 Pradeep Gatram (pradeepgatram)
on 2009-02-20 19:01
(Received via mailing list)
Charles,

Its still an issue on the 1.2 nightly build.

pradeep@pradeep-laptop:~/jruby-1.2.0/bin$ ./jruby -S irb
irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> require 'activesupport'
JRuby limited openssl loaded. gem install jruby-openssl for full
support.
http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL
=> true
irb(main):003:0> YAML.load(YAML.dump(3.0))
=> #<YAML::PrivateType:0x2d80ae @type_id="tag:yaml.org,
2002:float:Float", @value="3.0">
irb(main):004:0> YAML.load(YAML.dump(3.0)).eql?(3.0)
=> false
irb(main):005:0>
Ede2aa10c6462f1d825143879be59e38?d=identicon&s=25 Charles Oliver Nutter (Guest)
on 2009-02-20 20:10
(Received via mailing list)
Pradeep Gatram wrote:
> Charles,
>
> Its still an issue on the 1.2 nightly build.

Ahh, so it is. It's something specific to running with ActiveSupport
present, because it works fine with normal Ruby.

I've filed it here: http://jira.codehaus.org/browse/JRUBY-3423

Thank you!

- Charlie
561319f16a08e221a31d13f4419a7de4?d=identicon&s=25 Pradeep Gatram (pradeepgatram)
on 2009-02-21 06:07
(Received via mailing list)
Thanks Charles :)
This topic is locked and can not be replied to.