Module: Relaton::Xsf::Bibliography

Extended by:
Bibliography
Included in:
Bibliography
Defined in:
lib/relaton/xsf/bibliography.rb

Instance Method Summary collapse

Instance Method Details

#get(code, _year = nil, _opts = {}) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/relaton/xsf/bibliography.rb', line 10

def get(code, _year = nil, _opts = {})
  Util.info "Fetching from Relaton repository ...", key: code
  result = search(code)
  if result.empty?
    Util.info "Not found.", key: code
    return
  end

  bib = result.first.item
  Util.info "Found: `#{bib.docidentifier.first.content}`", key: code
  bib
end

#search(ref) ⇒ Object



6
7
8
# File 'lib/relaton/xsf/bibliography.rb', line 6

def search(ref)
  HitCollection.new(ref).search
end