require 'nokogiri' class NokoTest webpage = <<~END_PAGE
Marvin the Martian, from Warner Bros, was often angry.
Being disintegrated makes me very angry! Very angry indeed!
I’m not angry. Just terribly, terribly hurt.
You make me very angry, very angry.
Flux to blow Mars into subatomic space dust make me very angry.
END_PAGE html = Nokogiri.HTML(webpage) html.css('p').each do |node| # This strips any HTML tags from node.content: node.content = node.content.gsub('angry', 'happy') end puts "\n\nHTML:\n#{html}" end