Class: Relaton::Doi::Processor
- Inherits:
-
Core::Processor
- Object
- Core::Processor
- Relaton::Doi::Processor
- Defined in:
- lib/relaton/doi/processor.rb
Instance Attribute Summary collapse
-
#idtype ⇒ Object
readonly
Returns the value of attribute idtype.
Instance Method Summary collapse
- #fetch_data(_source, _opts) ⇒ Object
- #from_xml(xml) ⇒ Bib::ItemData
- #from_yaml(yaml) ⇒ Bib::ItemData
- #get(code, _date, _opts) ⇒ RelatonBib::BibliographicItem
-
#grammar_hash ⇒ String
Returns hash of XML grammar.
-
#initialize ⇒ Processor
constructor
rubocop:disable Lint/MissingSuper.
- #remove_index_file ⇒ Object
-
#threads ⇒ Integer
Returns number of threads.
Constructor Details
#initialize ⇒ Processor
rubocop:disable Lint/MissingSuper
8 9 10 11 12 13 |
# File 'lib/relaton/doi/processor.rb', line 8 def initialize # rubocop:disable Lint/MissingSuper @short = :relaton_doi @prefix = "DOI" @defaultprefix = %r{^doi:} @idtype = "DOI" end |
Instance Attribute Details
#idtype ⇒ Object (readonly)
Returns the value of attribute idtype.
6 7 8 |
# File 'lib/relaton/doi/processor.rb', line 6 def idtype @idtype end |
Instance Method Details
#fetch_data(_source, _opts) ⇒ Object
30 31 32 |
# File 'lib/relaton/doi/processor.rb', line 30 def fetch_data(_source, _opts) Util.info "This processor does not support fetching data by source name. Use `get` method with DOI instead." end |
#from_xml(xml) ⇒ Bib::ItemData
36 37 38 39 |
# File 'lib/relaton/doi/processor.rb', line 36 def from_xml(xml) require_relative "../doi" Bib::Item.from_xml xml end |
#from_yaml(yaml) ⇒ Bib::ItemData
43 44 45 46 |
# File 'lib/relaton/doi/processor.rb', line 43 def from_yaml(yaml) require_relative "../doi" Bib::Item.from_yaml yaml end |
#get(code, _date, _opts) ⇒ RelatonBib::BibliographicItem
19 20 21 22 |
# File 'lib/relaton/doi/processor.rb', line 19 def get(code, _date, _opts) require_relative "../doi" Crossref.get(code) end |
#grammar_hash ⇒ String
Returns hash of XML grammar
50 51 52 53 |
# File 'lib/relaton/doi/processor.rb', line 50 def grammar_hash require_relative "../doi" @grammar_hash ||= ::Relaton::Doi.grammar_hash end |
#remove_index_file ⇒ Object
55 56 57 |
# File 'lib/relaton/doi/processor.rb', line 55 def remove_index_file Util.info "This processor does not support index file. No action taken." end |
#threads ⇒ Integer
Returns number of threads
61 |
# File 'lib/relaton/doi/processor.rb', line 61 def threads = 2 |