Sha256: bec5face4b416708e5048f8adb781f7e9cec9262e2613c22b4c4fe54ffc22fdd

Contents?: true

Size: 1.44 KB

Versions: 13

Compression:

Stored size: 1.44 KB

Contents

require "relaton/processor"

module RelatonEcma
  class Processor < Relaton::Processor
    def initialize
      @short = :relaton_ecma
      @prefix = "ECMA"
      @defaultprefix = /^ECMA(-|\s)/
      @idtype = "ECMA"
      @datasets = %w[ecma-standards]
    end

    # @param code [String]
    # @param date [String, NilClass] year
    # @param opts [Hash]
    # @return [RelatonEcma::BibliographicItem]
    def get(code, date, opts)
      ::RelatonEcma::EcmaBibliography.get(code, date, opts)
    end

    #
    # Fetch all the documents from a source
    #
    # @param [String] source source name (iec-harmonized-all, iec-harmonized-latest)
    # @param [Hash] opts
    # @option opts [String] :output directory to output documents
    # @option opts [String] :format output format (xml, yaml, bibxml)
    #
    def fetch_data(_source, opts)
      DataFetcher.new(**opts).fetch
    end

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

    # @param hash [Hash]
    # @return [RelatonEcma::BibliographicItem]
    def hash_to_bib(hash)
      ::RelatonEcma::BibliographicItem.new hash
    end

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

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

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
relaton-ecma-1.19.1 lib/relaton_ecma/processor.rb
relaton-ecma-1.19.0 lib/relaton_ecma/processor.rb
relaton-ecma-1.18.1 lib/relaton_ecma/processor.rb
relaton-ecma-1.18.0 lib/relaton_ecma/processor.rb
relaton-ecma-1.17.0 lib/relaton_ecma/processor.rb
relaton-ecma-1.16.2 lib/relaton_ecma/processor.rb
relaton-ecma-1.16.1 lib/relaton_ecma/processor.rb
relaton-ecma-1.16.0 lib/relaton_ecma/processor.rb
relaton-ecma-1.14.6 lib/relaton_ecma/processor.rb
relaton-ecma-1.14.5 lib/relaton_ecma/processor.rb
relaton-ecma-1.14.4 lib/relaton_ecma/processor.rb
relaton-ecma-1.14.3 lib/relaton_ecma/processor.rb
relaton-ecma-1.14.2 lib/relaton_ecma/processor.rb