Sha256: bf80d29e506a2b821e6ce9bd8f08fd4637d1bb16f7f71ce6457faa869f8583a5

Contents?: true

Size: 1.56 KB

Versions: 3

Compression:

Stored size: 1.56 KB

Contents

require "relaton/processor"

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

    def initialize
      @short = :relaton_bipm
      @prefix = "BIPM"
      @defaultprefix = %r{^(?:BIPM|CCTF|CCDS|CGPM|CIPM)(?!\w)}
      @idtype = "BIPM"
      @datasets = %w[bipm-data-outcomes bipm-si-brochure rawdata-bipm-metrologia]
    end

    # @param code [String]
    # @param date [String, NilClass] year
    # @param opts [Hash]
    # @return [RelatonBipm::BipmBibliographicItem]
    def get(code, date, opts)
      ::RelatonBipm::BipmBibliography.get(code, date, opts)
    end

    #
    # Fetch all the documents from https://github.com/metanorma/bipm-data-outcomes,
    #   https://github.com/metanorma/bipm-si-brochure, https://github.com/relaton/rawdata-bipm-metrologia
    #
    # @param [String] source source name (bipm-data-outcomes, bipm-si-brochure,
    #   rawdata-bipm-metrologia)
    # @param [Hash] opts
    # @option opts [String] :output directory to output documents
    # @option opts [String] :format
    #
    def fetch_data(source, opts)
      DataFetcher.fetch(source, **opts)
    end

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

    # @param hash [Hash]
    # @return [RelatonBipm::BipmBibliographicItem]
    def hash_to_bib(hash)
      ::RelatonBipm::BipmBibliographicItem.from_hash hash
    end

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
relaton-bipm-1.14.4 lib/relaton_bipm/processor.rb
relaton-bipm-1.14.3 lib/relaton_bipm/processor.rb
relaton-bipm-1.14.2 lib/relaton_bipm/processor.rb