Sha256: f8746080d50497b31315b01e473442838b7e6921ead34ab5e95721fcd2e3eed6

Contents?: true

Size: 1.1 KB

Versions: 2

Compression:

Stored size: 1.1 KB

Contents

require "relaton/processor"

module RelatonIec
  class Processor < Relaton::Processor
    def initialize
      @short = :relaton_iec
      @prefix = "IEC"
      @defaultprefix = %r{^IEC\s|^IEV($|\s)}
      @idtype = "IEC"
    end

    # @param code [String]
    # @param date [String, NilClass] year
    # @param opts [Hash]
    # @return [RelatonIsoBib::IecBibliographicItem]
    def get(code, date, opts)
      ::RelatonIec::IecBibliography.get(code, date, opts)
    end

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

    # @param hash [Hash]
    # @return [RelatonIsoBib::IecBibliographicItem]
    def hash_to_bib(hash)
      item_hash = ::RelatonIec::HashConverter.hash_to_bib(hash)
      ::RelatonIec::IecBibliographicItem.new item_hash
    end

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

    # @param code [String]
    # @return [String, nil]
    def urn_to_code(code)
      RelatonIec.urn_to_code code
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
relaton-iec-1.7.7 lib/relaton_iec/processor.rb
relaton-iec-1.7.6 lib/relaton_iec/processor.rb