我需要从特定页面中的所有跨度中读取名为“data-contents”的属性的值
<span tabindex="0" title="" class="text-warning ng-isolate-scope" role="button" data-original-title="" data-toggle="popover" data-placement="top" data-html="true" data-contents="If you are not sure which type of occupation in the list to choose, please call us on (852) 2884 8888 and we'll be happy to help you." data-content="If you are not sure which type of occupation in the list to choose, please call us on (852) 2884 8888 and we'll be happy to help you." data-da-popover="" data-da-popover-id="daPopover1455178167018" data-container="body" data-trigger="focus"><img src="/app/ui/images/question-icon.png"> </span>
我写了以下代码,
b.spans.each do |span|
puts span.data-contents
end
但它抛出此错误':未定义的局部变量或方法'contents' for main:Object(NameError)'
任何人都可以帮我阅读这个数据内容的价值吗?