Sha256: edc6d56af3bd0818eeab7e50bf6a4e0c37f429b3a5cb9eb9cdc0bc5b8db74693

Contents?: true

Size: 1003 Bytes

Versions: 7

Compression:

Stored size: 1003 Bytes

Contents

require "relaton/processor"

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

    def initialize
      @short = :relaton_un
      @prefix = "UN"
      @defaultprefix = %r{^UN\s}
      @idtype = "UN"
    end

    # @param code [String]
    # @param date [String, NilClass] year
    # @param opts [Hash]
    # @return [RelatonUn::UnBibliographicItem]
    def get(code, date, opts)
      ::RelatonUn::UnBibliography.get(code, date, opts)
    end

    # @param xml [String]
    # @return [RelatonIsoBib::IsoBibliographicItem]
    def from_xml(xml)
      ::RelatonUn::XMLParser.from_xml xml
    end

    # @param hash [Hash]
    # @return [RelatonIsoBib::IsoBibliographicItem]
    def hash_to_bib(hash)
      item_hash = ::RelatonUn::HashConverter.hash_to_bib(hash)
      ::RelatonUn::UnBibliographicItem.new(**item_hash)
    end

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

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
relaton-un-1.13.0 lib/relaton_un/processor.rb
relaton-un-1.12.1 lib/relaton_un/processor.rb
relaton-un-1.12.0 lib/relaton_un/processor.rb
relaton-un-1.11.0 lib/relaton_un/processor.rb
relaton-un-1.10.1 lib/relaton_un/processor.rb
relaton-un-1.10.0 lib/relaton_un/processor.rb
relaton-un-1.9.0 lib/relaton_un/processor.rb