Class: RelatonDoi::Processor

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeProcessor

Returns a new instance of Processor.



7
8
9
10
11
12
13
# File 'lib/relaton_doi/processor.rb', line 7

def initialize
  @short = :relaton_doi
  @prefix = "DOI"
  @defaultprefix = %r{^doi:}
  @idtype = "DOI"
  # @datasets = %w[bipm-data-outcomes bipm-si-brochure]
end

Instance Attribute Details

#idtypeObject (readonly)

Returns the value of attribute idtype.



5
6
7
# File 'lib/relaton_doi/processor.rb', line 5

def idtype
  @idtype
end

Instance Method Details

#from_xml(xml) ⇒ RelatonBipm::BipmBibliographicItem

Parameters:

  • xml (String)

Returns:

  • (RelatonBipm::BipmBibliographicItem)


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

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

#get(code, _date, _opts) ⇒ RelatonBib::BibliographicItem

Parameters:

  • code (String)

    DOI

  • date (String, nil)

    year

  • opts (Hash)

Returns:

  • (RelatonBib::BibliographicItem)


19
20
21
# File 'lib/relaton_doi/processor.rb', line 19

def get(code, _date, _opts)
  Crossref.get(code)
end

#grammar_hashString

Returns hash of XML grammar

Returns:

  • (String)


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

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

#hash_to_bib(hash) ⇒ RelatonBipm::BipmBibliographicItem

Parameters:

  • hash (Hash)

Returns:

  • (RelatonBipm::BipmBibliographicItem)


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

def hash_to_bib(hash)
  ::RelatonBib::BibliographicItem.from_hash hash
end

#threadsInteger

Returns number of threads

Returns:

  • (Integer)


53
54
55
# File 'lib/relaton_doi/processor.rb', line 53

def threads
  2
end