class NistBib::Hit

Hit.

Attributes

hit[R]

@return [Array<Hash>]

hit_collection[R]

@return [NistBib::HitCollection]

Public Class Methods

new(hit, hit_collection = nil) click to toggle source

@param hit [Hash] @param hit_collection [NistBib:HitCollection]

# File lib/nistbib/hit.rb, line 14
def initialize(hit, hit_collection = nil)
  @hit            = hit
  @hit_collection = hit_collection
end

Public Instance Methods

fetch() click to toggle source

Parse page. @return [NistBib::NistBliographicItem]

# File lib/nistbib/hit.rb, line 21
def fetch
  @fetch ||= Scrapper.parse_page @hit
end
inspect() click to toggle source

@return [String]

# File lib/nistbib/hit.rb, line 31
def inspect
  "<#{self.class}:#{format('%#.14x', object_id << 1)} "\
  "@text=\"#{@hit_collection&.text}\" "\
  "@fetched=\"#{!@fetch.nil?}\" "\
  "@fullIdentifier=\"#{@fetch&.shortref(nil)}\" "\
  "@title=\"#{@hit[:code]}\">"
end
to_s() click to toggle source

@return [String]

# File lib/nistbib/hit.rb, line 26
def to_s
  inspect
end
to_xml(**opts) click to toggle source

@return [String]

# File lib/nistbib/hit.rb, line 40
def to_xml(**opts)
  fetch.to_xml **opts
end