Sha256: 60c19a7836997a214959fc5c27c5e60d9c4249b479b94871f9c6990681de2776

Contents?: true

Size: 1.5 KB

Versions: 4

Compression:

Stored size: 1.5 KB

Contents

require "relaton/processor"

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

    def initialize # rubocop:disable Lint/MissingSuper
      @short = :relaton_ieee
      @prefix = "IEEE"
      @defaultprefix = %r{^(?:ANSI/)?IEEE\s}
      @idtype = "IEEE"
      @datasets = %w[ieee-rawbib]
    end

    # @param code [String]
    # @param date [String, NilClass] year
    # @param opts [Hash]
    # @return [RelatonIeee::IeeeBibliographicItem]
    def get(code, date, opts)
      ::RelatonIeee::IeeeBibliography.get(code, date, opts)
    end

    #
    # Fetch all the documents from ./iee-rawbib directory
    #
    # @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 [RelatonIeee::IeeeBibliographicItem]
    def from_xml(xml)
      ::RelatonIeee::XMLParser.from_xml xml
    end

    # @param hash [Hash]
    # @return [RelatonIeee::IeeeBibliographicItem]
    def hash_to_bib(hash)
      ::RelatonIeee::IeeeBibliographicItem.new(**hash)
    end

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

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
relaton-ieee-1.16.2 lib/relaton_ieee/processor.rb
relaton-ieee-1.16.1 lib/relaton_ieee/processor.rb
relaton-ieee-1.16.0 lib/relaton_ieee/processor.rb
relaton-ieee-1.14.8 lib/relaton_ieee/processor.rb