# How can I sort the data one after the other?

**URL:** <https://www.ruby-forum.com/t/how-can-i-sort-the-data-one-after-the-other/261421>\
**Category:** Development\
**Created:** [June 18, 2021, 7:29pm UTC](https://www.ruby-forum.com/t/how-can-i-sort-the-data-one-after-the-other/261421 "2021-06-18T19:29:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![elturco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/b5a626/32.png) [@elturco](https://www.ruby-forum.com/u/elturco)\
**Post date:** [June 18, 2021, 7:29pm UTC](https://www.ruby-forum.com/t/how-can-i-sort-the-data-one-after-the-other/261421/1 "2021-06-18T19:29:43Z")

</div>

page.css(".div").text

---

<div class="post-metadata">

**Author:** ![brodyhoskins](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/cab0a1/32.png) [@brodyhoskins](https://www.ruby-forum.com/u/brodyhoskins)\
**Post date:** [June 29, 2021, 6:19am UTC](https://www.ruby-forum.com/t/how-can-i-sort-the-data-one-after-the-other/261421/2 "2021-06-29T06:19:37Z")

</div>

Depending what kind of text you’re dealing with, I would suggest converting it to an array and then sorting from there:

```auto
text = page.css('div').text
text.split("\n").sort

```

This looks like Nokogiri but I can’t remember exactly what `text` returns — depending on the HTML it might be easier to get the HTML or the children elements and work with that data instead.
