How can I sort the data one after the other?

page.css(".div").text

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

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.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs