Class: RelatonIsbn::Processor

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeProcessor

rubocop:disable Lint/MissingSuper



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

def initialize # rubocop:disable Lint/MissingSuper
  @short = :relaton_isbn
  @prefix = "ISBN"
  @defaultprefix = /^ISBN\s/
  @idtype = "ISBN"
  @datasets = %w[]
end

Instance Attribute Details

#idtypeObject (readonly)

Returns the value of attribute idtype.



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

def idtype
  @idtype
end

Instance Method Details

#from_xml(xml) ⇒ RelatonBib::BibliographicItem

Parameters:

  • xml (String)

Returns:

  • (RelatonBib::BibliographicItem)


36
37
38
# File 'lib/relaton_isbn/processor.rb', line 36

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

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

Parameters:

  • code (String)
  • date (String, nil)

    year

  • opts (Hash)

Returns:

  • (RelatonBib::BibliographicItem)


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

def get(code, date, opts)
  ::RelatonIsbn::OpenLibrary.get(code, date, opts)
end

#grammar_hashString

Returns hash of XML grammar

Returns:

  • (String)


48
49
50
# File 'lib/relaton_isbn/processor.rb', line 48

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

#hash_to_bib(hash) ⇒ RelatonBib::BibliographicItem

Parameters:

  • hash (Hash)

Returns:

  • (RelatonBib::BibliographicItem)


42
43
44
# File 'lib/relaton_isbn/processor.rb', line 42

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