Sha256: 353b08246ba5b1481edf52c4400576fca6d472f7e3fa90cb0af88e27f34d0299
Contents?: true
Size: 842 Bytes
Versions: 8
Compression:
Stored size: 842 Bytes
Contents
require 'nokogiri' require 'ms/ident/pepxml/search_hit' module Ms ; end module Ms::Ident ; end class Ms::Ident::Pepxml ; end class Ms::Ident::Pepxml::SearchResult # an array of search_hits attr_accessor :search_hits # if block given, then yields an empty search_hits array. # For consistency with other objects, will also take a hash that has the key # :search_hits and the value an array. def initialize(search_hits = [], &block) @search_hits = search_hits if search_hits.is_a?(Hash) @search_hits = search_hits[:search_hits] end block.call(@search_hits) if block end def to_xml(builder=nil) xmlb = builder || Nokogiri::XML::Builder.new builder.search_result do |xmlb| search_hits.each do |sh| sh.to_xml(xmlb) end end builder || xmlb.doc.root.to_xml end end
Version data entries
8 entries across 8 versions & 1 rubygems