#cssreturns a collection, use #at_cssto get the first node match. All its contents, even text, are children, in which case the text is its first child. You can also do something like children.reject &element?if you want all the children not to be elements.
data = '
<div class="featured">
<h1>
How to extract this?
<span>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</span>
<span class="moredetail ">
<a href="/hello" title="hello">hello</a>
</span>
<div class="clear"></div>
</h1>
</div>
'
require 'nokogiri'
text = Nokogiri::HTML(data).at_css('.featured h1').children.first.text
text # => "\n How to extract this?\n "
xpaths:
Nokogiri::HTML(data).at_xpath('//*[@class="featured"]/h1/text()').text