Class: RelatonOasis::Processor

Inherits:
Relaton::Processor
  • Object
show all
Defined in:
lib/relaton_oasis/processor.rb

Instance Method Summary collapse

Constructor Details

#initializeProcessor

rubocop:disable Lint/MissingSuper



5
6
7
8
9
10
11
# File 'lib/relaton_oasis/processor.rb', line 5

def initialize # rubocop:disable Lint/MissingSuper
  @short = :relaton_oasis
  @prefix = "OASIS"
  @defaultprefix = %r{^OASIS\s}
  @idtype = "OASIS"
  @datasets = %w[oasis-open]
end

Instance Method Details

#fetch_data(_source, opts) ⇒ Object

Fetch all the documents from www.oasis-open.org/standards/

Parameters:

  • source (String)

    source name

  • opts (Hash)

Options Hash (opts):

  • :output (String)

    directory to output documents

  • :format (String)


29
30
31
# File 'lib/relaton_oasis/processor.rb', line 29

def fetch_data(_source, opts)
  DataFetcher.fetch(**opts)
end

#from_xml(xml) ⇒ RelatonBib::BibliographicItem

Parameters:

  • xml (String)

Returns:

  • (RelatonBib::BibliographicItem)


35
36
37
# File 'lib/relaton_oasis/processor.rb', line 35

def from_xml(xml)
  ::RelatonOasis::XMLParser.from_xml xml
end

#get(code, date, opts) ⇒ RelatonBib::BibliographicItem

Parameters:

  • code (String)
  • date (String, NilClass)

    year

  • opts (Hash)

Returns:

  • (RelatonBib::BibliographicItem)


17
18
19
# File 'lib/relaton_oasis/processor.rb', line 17

def get(code, date, opts)
  ::RelatonOasis::OasisBibliography.get(code, date, opts)
end

#grammar_hashString

Returns hash of XML grammar

Returns:

  • (String)


47
48
49
# File 'lib/relaton_oasis/processor.rb', line 47

def grammar_hash
  @grammar_hash ||= ::RelatonOasis.grammar_hash
end

#hash_to_bib(hash) ⇒ RelatonBib::BibliographicItem

Parameters:

  • hash (Hash)

Returns:

  • (RelatonBib::BibliographicItem)


41
42
43
# File 'lib/relaton_oasis/processor.rb', line 41

def hash_to_bib(hash)
  ::RelatonOasis::OasisBibliographicItem.from_hash hash
end

#remove_index_fileObject

Remove index file



54
55
56
# File 'lib/relaton_oasis/processor.rb', line 54

def remove_index_file
  Relaton::Index.find_or_create(:oasis, url: true, file: OasisBibliography::INDEX_FILE).remove_file
end