Sha256: 1b245e63dfc85d6ab2c00d468ba02d82f59d37cd85a8c61262a33f0a32a371d2

Contents?: true

Size: 1.51 KB

Versions: 9

Compression:

Stored size: 1.51 KB

Contents

require "relaton/processor"

module RelatonCalconnect
  class Processor < Relaton::Processor
    attr_reader :idtype

    def initialize # rubocop:disable Lint/MissingSuper
      @short = :relaton_calconnect
      @prefix = "CC"
      @defaultprefix = %r{^CC(?!\w)}
      @idtype = "CC"
      @datasets = %w[calconnect-org]
    end

    # @param code [String]
    # @param date [String, NilClass] year
    # @param opts [Hash]
    # @return [RelatonCalconnect::CcBibliographicItem]
    def get(code, date, opts)
      ::RelatonCalconnect::CcBibliography.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 [RelatonCalconnect::CcBibliographicItem]
    def from_xml(xml)
      ::RelatonCalconnect::XMLParser.from_xml xml
    end

    # @param hash [Hash]
    # @return [RelatonIsoBib::CcBibliographicItem]
    def hash_to_bib(hash)
      ::RelatonCalconnect::CcBibliographicItem.from_hash hash
    end

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

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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
relaton-calconnect-1.20.0 lib/relaton_calconnect/processor.rb
relaton-calconnect-1.19.1 lib/relaton_calconnect/processor.rb
relaton-calconnect-1.19.0 lib/relaton_calconnect/processor.rb
relaton-calconnect-1.18.0 lib/relaton_calconnect/processor.rb
relaton-calconnect-1.17.0 lib/relaton_calconnect/processor.rb
relaton-calconnect-1.16.2 lib/relaton_calconnect/processor.rb
relaton-calconnect-1.16.1 lib/relaton_calconnect/processor.rb
relaton-calconnect-1.16.0 lib/relaton_calconnect/processor.rb
relaton-calconnect-1.14.2 lib/relaton_calconnect/processor.rb