html file = /home/raj/test.html
<td class="m_7818752582546518432m_-7154585397242854273small-12 m_7818752582546518432m_-7154585397242854273large-3 m_7818752582546518432m_-7154585397242854273text-body" style="border-collapse:collapse!important;color:#0a0a0a;font-family:'Roboto-Regular',sans-serif;font-size:16px;font-weight:normal;letter-spacing:0;line-height:20px;margin:0;padding:0 8px;width:129px;word-wrap:break-word" align="left" valign="top">
2882524
</td>
Пробовал в irb ruby версии 2.6.1 как,
2.6.1 :026 > require 'nokogiri'
=> true
2.6.1 :027 > doc = Nokogiri::HTML(File.open('/home/raj/test.html'))
=> #<Nokogiri::HTML::Document:0x2ac37b6e06a4 name="document" children=[#<Nokogiri::XML::DTD:0x2ac37b6e02a8 name="html">, #<Nokogiri::XML::Element:0x2ac37b703d5c name="html" children=[#<Nokogiri::XML::Element:0x2ac37b703a28 name="body" children=[#<Nokogiri::XML::Element:0x2ac37b7037e4 name="td" attributes=[#<Nokogiri::XML::Attr:0x2ac37b70376c name="class" value="m_7818752582546518432m_-7154585397242854273small-12 m_7818752582546518432m_-7154585397242854273large-3 m_7818752582546518432m_-7154585397242854273text-body">, #<Nokogiri::XML::Attr:0x2ac37b703758 name="style" value="border-collapse:collapse!important;color:#0a0a0a;font-family:'Roboto-Regular',sans-serif;font-size:16px;font-weight:normal;letter-spacing:0;line-height:20px;margin:0;padding:0 8px;width:129px;word-wrap:break-word">, #<Nokogiri::XML::Attr:0x2ac37b703744 name="align" value="left">, #<Nokogiri::XML::Attr:0x2ac37b703730 name="valign" value="top">] children=[#<Nokogiri::XML::Text:0x2ac37b7027b8 "\n 2882524\n ">]>, #<Nokogiri::XML::Text:0x2ac37b702484 "\n">]>]>]>
2.6.1 :034 > doc.text
=> "\n 2882524\n \n"
2.6.1 :035 > doc.text.strip
=> "2882524"