Sha256: f3e28cb32dff02121d1c4d7b874f75535fef254dfafe992da5f164d5a9a8ecfb
Contents?: true
Size: 1.2 KB
Versions: 3
Compression:
Stored size: 1.2 KB
Contents
# frozen_string_literal: true module RelatonIso # Hit. class Hit # @return [RelatonIso::HitCollection] attr_reader :hit_collection # @return [Array<Hash>] attr_reader :hit # @param hit [Hash] # @param hit_collection [RelatonIso:HitCollection] def initialize(hit, hit_collection = nil) @hit = hit @hit_collection = hit_collection end # Parse page. # @return [RelatonIso::IsoBibliographicItem] def fetch @fetch ||= Scrapper.parse_page @hit end # @return [String] def to_s inspect end # @return [String] def inspect # matched_words = @hit["_highlightResult"]. # reduce([]) { |a, (_k, v)| a + v["matchedWords"] }.uniq "<#{self.class}:#{format('%#.14x', object_id << 1)} "\ "@text=\"#{@hit_collection&.ref}\" "\ "@reference=\"#{@hit["docRef"]}\"" end # @param builder [Nokogiri::XML::Builder] def to_xml(builder = nil, **opts) if builder fetch.to_xml builder, **opts else builder = Nokogiri::XML::Builder.new(encoding: "UTF-8") do |xml| fetch.to_xml xml, **opts end builder.doc.root.to_xml end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
relaton-iso-0.6.0 | lib/relaton_iso/hit.rb |
relaton-iso-0.5.5 | lib/relaton_iso/hit.rb |
relaton-iso-0.5.4 | lib/relaton_iso/hit.rb |