Sha256: 94c4186ab6c2b8b29791d34a4cc12503371550d6de3c114a8a36064a39e51eec

Contents?: true

Size: 1.51 KB

Versions: 21

Compression:

Stored size: 1.51 KB

Contents

require "relaton/processor"

module RelatonNist
  class Processor < Relaton::Processor
    def initialize # rubocop:disable Lint/MissingSuper
      @short = :relaton_nist
      @prefix = "NIST"
      @defaultprefix = %r{^(NIST|NBS|NISTGCR|ITL Bulletin|JPCRD|NISTIR|CSRC|FIPS)(/[^\s])?\s}
      @idtype = "NIST"
      @datasets = %w[nist-tech-pubs]
    end

    # @param code [String]
    # @param date [String, NilClass] year
    # @param opts [Hash]
    # @return [RelatonNist::GbBibliographicItem]
    def get(code, date = nil, opts = {})
      ::RelatonNist::NistBibliography.get(code, date, opts)
    end

    #
    # Fetch all the documents from a source
    #
    # @param [String] _source source name
    # @param [Hash] opts
    # @option opts [String] :output directory to output documents
    # @option opts [String] :format
    #
    def fetch_data(_source, opts)
      DataFetcher.fetch(**opts)
    end

    # @param xml [String]
    # @return [RelatonNist::GbBibliographicItem]
    def from_xml(xml)
      ::RelatonNist::XMLParser.from_xml xml
    end

    # @param hash [Hash]
    # @return [RelatonNist::GbBibliographicItem]
    def hash_to_bib(hash)
      ::RelatonNist::NistBibliographicItem.from_hash hash
    end

    # Returns hash of XML grammar
    # @return [String]
    def grammar_hash
      @grammar_hash ||= ::RelatonNist.grammar_hash
    end

    #
    # Remove index file
    #
    def remove_index_file
      Relaton::Index.find_or_create(:nist, url: true, file: HitCollection::INDEX_FILE).remove_file
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
relaton-nist-1.20.0 lib/relaton_nist/processor.rb
relaton-nist-1.19.7 lib/relaton_nist/processor.rb
relaton-nist-1.19.6 lib/relaton_nist/processor.rb
relaton-nist-1.19.5 lib/relaton_nist/processor.rb
relaton-nist-1.19.4 lib/relaton_nist/processor.rb
relaton-nist-1.19.3 lib/relaton_nist/processor.rb
relaton-nist-1.19.1 lib/relaton_nist/processor.rb
relaton-nist-1.19.0 lib/relaton_nist/processor.rb
relaton-nist-1.18.0 lib/relaton_nist/processor.rb
relaton-nist-1.17.0 lib/relaton_nist/processor.rb
relaton-nist-1.16.4 lib/relaton_nist/processor.rb
relaton-nist-1.16.3 lib/relaton_nist/processor.rb
relaton-nist-1.16.2 lib/relaton_nist/processor.rb
relaton-nist-1.16.1 lib/relaton_nist/processor.rb
relaton-nist-1.16.0 lib/relaton_nist/processor.rb
relaton-nist-1.14.9 lib/relaton_nist/processor.rb
relaton-nist-1.14.8 lib/relaton_nist/processor.rb
relaton-nist-1.14.7 lib/relaton_nist/processor.rb
relaton-nist-1.14.6 lib/relaton_nist/processor.rb
relaton-nist-1.14.5 lib/relaton_nist/processor.rb