Skip to content

Instantly share code, notes, and snippets.

@kaiwren
Created February 23, 2011 18:31
Show Gist options
  • Save kaiwren/840893 to your computer and use it in GitHub Desktop.
Save kaiwren/840893 to your computer and use it in GitHub Desktop.
Hash ordering in Jruby vs CRuby
~ λ rvm jruby-head
~ λ ruby -v
jruby 1.6.0.dev (ruby 1.8.7 patchlevel 249) (2011-01-13 b9f8624) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_22) [darwin-x86_64-java]
~ λ irb
jruby-head :001 > {:a => :b, :c => :d}.select{true}
=> [[:a, :b], [:c, :d]]
jruby-head :002 > {:a => :b, :c => :d}.select{true}
=> [[:a, :b], [:c, :d]]
jruby-head :003 > {:a => :b, :c => :d}.select{true}
=> [[:a, :b], [:c, :d]]
jruby-head :004 > {:a => :b, :c => :d}.select{true}
=> [[:a, :b], [:c, :d]]
--------------------------
~ λ rvm 1.8.7
~ λ ruby -v
ruby 1.8.7 (2010-12-23 patchlevel 330) [i686-darwin10.6.0]
~ λ irb
ruby-1.8.7-p330 :001 > {:a => :b, :c => :d}.select{true}
=> [[:c, :d], [:a, :b]]
ruby-1.8.7-p330 :002 > {:a => :b, :c => :d}.select{true}
=> [[:c, :d], [:a, :b]]
ruby-1.8.7-p330 :003 > {:a => :b, :c => :d}.select{true}
=> [[:c, :d], [:a, :b]]
ruby-1.8.7-p330 :004 > {:a => :b, :c => :d}.select{true}
=> [[:c, :d], [:a, :b]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment