Class: BibSync::Actions::DetermineArXivDOI

Inherits:
Object
  • Object
show all
Includes:
Log, Utils
Defined in:
lib/bibsync/actions/determine_arxiv_doi.rb

Constant Summary

Constants included from Log

Log::Blue, Log::Level, Log::Red, Log::Reset, Log::Yellow

Instance Method Summary collapse

Methods included from Log

#log

Methods included from Utils

#arxiv_download, #arxiv_id, #fetch, #fetch_xml, #name_without_ext

Constructor Details

#initialize(options) ⇒ DetermineArXivDOI

Returns a new instance of DetermineArXivDOI.



7
8
9
10
# File 'lib/bibsync/actions/determine_arxiv_doi.rb', line 7

def initialize(options)
  raise 'Option --bib is required' unless @bib = options[:bib]
  @force = options[:resync]
end

Instance Method Details

#runObject



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/bibsync/actions/determine_arxiv_doi.rb', line 12

def run
  notice 'Determine arXiv and DOI identifiers'

  @bib.each do |entry|
    next if entry.comment? ||
            (entry[:doi] && entry[:arxiv]) ||
            (!@force && entry[:title] && entry[:author] && entry[:year])

    determine_arxiv_and_doi(entry)
  end
end