Sha256: 37b2356b276f87a5fd5aa6208d8c93512dfd572f4117b2c0065b10ea83e8601b

Contents?: true

Size: 1.59 KB

Versions: 11

Compression:

Stored size: 1.59 KB

Contents

require "relaton/processor"

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

    def initialize # rubocop:disable Lint/MissingSuper
      @short = :relaton_w3c
      @prefix = "W3C"
      @defaultprefix = %r{^W3C\s}
      @idtype = "W3C"
      @datasets = %w[w3c-rdf w3c-tr-archive]
    end

    # @param code [String]
    # @param date [String, NilClass] year
    # @param opts [Hash]
    # @return [RelatonW3C::W3cBibliographicItem]
    def get(code, date, opts)
      ::RelatonW3c::W3cBibliography.get(code, date, opts)
    end

    #
    # Fetch all the documents from http://www.w3.org/2002/01/tr-automation/tr.rdf
    #
    # @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)
      DataFetcher.fetch(source, **opts)
    end

    # @param xml [String]
    # @return [RelatonCalconnect::CcBibliographicItem]
    def from_xml(xml)
      ::RelatonW3c::XMLParser.from_xml xml
    end

    # @param hash [Hash]
    # @return [RelatonIsoBib::CcBibliographicItem]
    def hash_to_bib(hash)
      item_hash = ::RelatonW3c::HashConverter.hash_to_bib(hash)
      ::RelatonW3c::W3cBibliographicItem.new(**item_hash)
    end

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

    #
    # Remove index file
    #
    def remove_index_file
      Relaton::Index.find_or_create(:W3C, url: true, file: "#{W3cBibliography::INDEX}.yaml").remove_file
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
relaton-w3c-1.19.0 lib/relaton_w3c/processor.rb
relaton-w3c-1.18.1 lib/relaton_w3c/processor.rb
relaton-w3c-1.18.0 lib/relaton_w3c/processor.rb
relaton-w3c-1.17.3 lib/relaton_w3c/processor.rb
relaton-w3c-1.17.2 lib/relaton_w3c/processor.rb
relaton-w3c-1.17.1 lib/relaton_w3c/processor.rb
relaton-w3c-1.17.0 lib/relaton_w3c/processor.rb
relaton-w3c-1.16.1 lib/relaton_w3c/processor.rb
relaton-w3c-1.16.0 lib/relaton_w3c/processor.rb
relaton-w3c-1.14.3 lib/relaton_w3c/processor.rb
relaton-w3c-1.14.2 lib/relaton_w3c/processor.rb