{"version":"1.0","type":"rich","title":"Ruby: sort by two array elements","description":"This example demonstrates a custom sorting routine for an array of sub-arrays, comparing elements by two keys in sequence. It first compares the values at index 1, converting them to lowercase with `downcase` to ensure case-insensitive ordering. If those values are equal, it falls back to comparing the values at index 2, also lowercased, using Ruby’s spaceship operator `<=>`. The sort is performed in-place via the `Array#sort` method with a block, making the secondary comparison a tie-breaker.","provider_name":"VizHub AI Studio","provider_url":"https://next.vizhub.com","html":"<iframe src=\"https://next.vizhub.com/viz/gist-3408312?mode=embed\" width=\"960\" height=\"500\" scrolling=\"no\" frameborder=\"1\"></iframe>","width":960,"height":500,"cache_age":3600}