Sha256: adb17c9f191d9d28669d8b4b240123279552cd65c98498ea26dc8113673d4bdb

Contents?: true

Size: 1.56 KB

Versions: 9

Compression:

Stored size: 1.56 KB

Contents

require "relaton/processor"

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

    def initialize # rubocop:disable Lint/MissingSuper
      @short = :relaton_xsf
      @prefix = "XEP"
      @defaultprefix = %r{^XEP\s}
      @idtype = "XEP"
      @datasets = %w[xep-xmpp]
    end

    # @param code [String]
    # @param date [String, nil] year
    # @param opts [Hash]
    # @return [RelatonXsf::BibliographicItem]
    def get(code, date, opts)
      ::RelatonXsf::Bibliography.get(code, date, opts)
    end

    #
    # Fetch all the documents from http://xml2rfc.tools.ietf.org/public/rfc/bibxml-3gpp-new/
    #
    # @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)
      ::RelatonXsf::DataFetcher.fetch(**opts)
    end

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

    # @param hash [Hash]
    # @return [RelatonXsf::BibliographicItem]
    def hash_to_bib(hash)
      item_hash = ::RelatonXsf::HashConverter.hash_to_bib(hash)
      ::RelatonXsf::BibliographicItem.new(**item_hash)
    end

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

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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
relaton-xsf-1.20.0 lib/relaton_xsf/processor.rb
relaton-xsf-1.19.0 lib/relaton_xsf/processor.rb
relaton-xsf-1.18.1 lib/relaton_xsf/processor.rb
relaton-xsf-1.18.0 lib/relaton_xsf/processor.rb
relaton-xsf-1.17.0 lib/relaton_xsf/processor.rb
relaton-xsf-1.16.2 lib/relaton_xsf/processor.rb
relaton-xsf-1.16.1 lib/relaton_xsf/processor.rb
relaton-xsf-1.16.0 lib/relaton_xsf/processor.rb
relaton-xsf-1.14.0 lib/relaton_xsf/processor.rb