Class: Relaton::Isbn::Processor

Inherits:
Core::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



8
9
10
11
12
13
14
# File 'lib/relaton/isbn/processor.rb', line 8

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.



6
7
8
# File 'lib/relaton/isbn/processor.rb', line 6

def idtype
  @idtype
end

Instance Method Details

#from_xml(xml) ⇒ Relaton::Bib::Bibitem

Parameters:

  • xml (String)

Returns:

  • (Relaton::Bib::Bibitem)


28
29
30
31
# File 'lib/relaton/isbn/processor.rb', line 28

def from_xml(xml)
  require_relative "../isbn"
  ::Relaton::Bib::Bibitem.from_xml xml
end

#from_yaml(hash) ⇒ Relaton::Bib::Bibitem

Parameters:

  • hash (Hash)

Returns:

  • (Relaton::Bib::Bibitem)


35
36
37
38
# File 'lib/relaton/isbn/processor.rb', line 35

def from_yaml(hash)
  require_relative "../isbn"
  ::Relaton::Bib::Bibitem.from_hash hash
end

#get(code, date, opts) ⇒ Relaton::Bib::Bibitem

Parameters:

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

    year

  • opts (Hash)

Returns:

  • (Relaton::Bib::Bibitem)


20
21
22
23
# File 'lib/relaton/isbn/processor.rb', line 20

def get(code, date, opts)
  require_relative "../isbn"
  ::Relaton::Isbn::OpenLibrary.get(code, date, opts)
end

#grammar_hashString

Returns hash of XML grammar

Returns:

  • (String)


42
43
44
45
# File 'lib/relaton/isbn/processor.rb', line 42

def grammar_hash
  require_relative "../isbn"
  @grammar_hash ||= ::Relaton::Isbn.grammar_hash
end