Sha256: e44e681789f985931c31f0e1d5c242ace644d60d451997e296d9c2c633f31932
Contents?: true
Size: 1.41 KB
Versions: 7
Compression:
Stored size: 1.41 KB
Contents
# frozen_string_literal: true module RelatonGb # Hit. class Hit # @return [Isobib::HitCollection] attr_reader :hit_collection # @return [String] attr_reader :pid # @return [String] attr_reader :title # @return [RelatonGb::GbScrapper, RelatonGb::SecScraper, RelatonGb::TScrapper] attr_reader :scrapper # @param hit [Hash] # @param hit_collection [Isobib:HitCollection] def initialize(pid:, title:, hit_collection: nil, scrapper:) @pid = pid @title = title @hit_collection = hit_collection @scrapper = scrapper self.hit_collection << self if hit_collection end # Parse page. # @return [Isobib::IsoBibliographicItem] def fetch @fetch ||= scrapper.scrape_doc pid end # @return [String] def to_s inspect end # @return [String] def inspect "<#{self.class}:#{format('%#.14x', object_id << 1)} "\ "@fullIdentifier=\"#{@fetch&.shortref}\" "\ "@title=\"#{title}\">" end # @param builder [Nokogiri::XML::Builder] # @param opts [Hash] # @return [String] # 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
7 entries across 7 versions & 1 rubygems