Alex Zakruzhetskyi Alex Zakruzhetskyi - 1 year ago 78
Ruby Question

Is it possible not to get two last elements via nokogiri?

I want to take all

elements, using this code:

novelty.body = page.css('.rt-article p').text

but I don't want to get last two
elements. Is it possible to do?

Answer Source


page.css('.rt-article p').text.slice(0...-2)

Notice, there are three dots.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download