Skip to content

Instantly share code, notes, and snippets.

@ZenCocoon
Created January 15, 2010 09:27
Show Gist options
  • Save ZenCocoon/277923 to your computer and use it in GitHub Desktop.
Save ZenCocoon/277923 to your computer and use it in GitHub Desktop.
>> returning(ActiveSupport::OrderedHash.new) do |map| %w(a c b).each{|n| map[n] = n } end.to_json
=> "{\"a\":\"a\",\"c\":\"c\",\"b\":\"b\"}"
>> returning(ActiveSupport::OrderedHash.new) do |map| %w(a c b).each{|n| map[n] = n } end.sort.to_json
=> "[[\"a\",\"a\"],[\"b\",\"b\"],[\"c\",\"c\"]]"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment