<p ng-if="!me.admin" class="sv ng-binding ng-scope" ng-repeat="x in user.groups | orderBy">NASS InfoPass Scheduler</p>
<p ng-if="!me.admin" class="sv ng-binding ng-scope" ng-repeat="x in user.groups | orderBy">NASS Adjudications Scheduler</p>
如何使用class="sv ng-binding ng-scope"
作为数组来获取文本?
答案 0 :(得分:0)
使用Nokogiri,您可以将文本提取为
require 'nokogiri'
# suppose you store your HTML text in variable `html'
html = <<EOF
<p ng-if="!me.admin" class="sv ng-binding ng-scope" ng-repeat="x in user.groups | orderBy">NASS InfoPass Scheduler</p>
<p ng-if="!me.admin" class="sv ng-binding ng-scope" ng-repeat="x in user.groups | orderBy">NASS Adjudications Scheduler</p>r</p>
EOF
doc = Nokogiri::HTML(html)
p doc.css('.sv.ng-binding.ng-scope').map(&:text)
#=> ["NASS InfoPass Scheduler", "NASS Adjudications Scheduler"]