Class: RelatonNist::Processor

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

Instance Method Summary collapse

Constructor Details

#initializeProcessor

Returns a new instance of Processor.



5
6
7
8
9
10
# File 'lib/relaton_nist/processor.rb', line 5

def initialize
  @short = :relaton_nist
  @prefix = "NIST"
  @defaultprefix = %r{^(NIST|NISTGCR|ITL Bulletin|JPCRD|NISTIR|CSRC|FIPS)(/[^\s])?\s}
  @idtype = "NIST"
end

Instance Method Details

#from_xml(xml) ⇒ RelatonNist::GbBibliographicItem

Parameters:

  • xml (String)

Returns:

  • (RelatonNist::GbBibliographicItem)


22
23
24
# File 'lib/relaton_nist/processor.rb', line 22

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

#get(code, date = nil, opts = {}) ⇒ RelatonNist::GbBibliographicItem

Parameters:

  • code (String)
  • date (String, NilClass) (defaults to: nil)

    year

  • opts (Hash) (defaults to: {})

Returns:

  • (RelatonNist::GbBibliographicItem)


16
17
18
# File 'lib/relaton_nist/processor.rb', line 16

def get(code, date = nil, opts = {})
  ::RelatonNist::NistBibliography.get(code, date, opts)
end

#grammar_hashString

Returns hash of XML grammar

Returns:

  • (String)


34
35
36
# File 'lib/relaton_nist/processor.rb', line 34

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

#hash_to_bib(hash) ⇒ RelatonNist::GbBibliographicItem

Parameters:

  • hash (Hash)

Returns:

  • (RelatonNist::GbBibliographicItem)


28
29
30
# File 'lib/relaton_nist/processor.rb', line 28

def hash_to_bib(hash)
  ::RelatonNist::NistBibliographicItem.from_hash hash
end