Class: RelatonGb::Processor

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

Instance Method Summary collapse

Constructor Details

#initializeProcessor

Returns a new instance of Processor.



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

def initialize
  @short = :relaton_gb
  @prefix = "CN"
  @defaultprefix = %r{^(GB|GB/T|GB/Z) }
  @idtype = "Chinese Standard"
end

Instance Method Details

#from_xml(xml) ⇒ RelatonGb::GbBibliographicItem

Parameters:

  • xml (String)

Returns:



24
25
26
# File 'lib/relaton_gb/processor.rb', line 24

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

#get(code, date, opts) ⇒ RelatonGb::GbBibliographicItem

Parameters:

  • code (String)
  • date (String, NilClass)

    year

  • opts (Hash)

Returns:



18
19
20
# File 'lib/relaton_gb/processor.rb', line 18

def get(code, date, opts)
  ::RelatonGb::GbBibliography.get(code, date, opts)
end

#grammar_hashString

Returns hash of XML grammar

Returns:

  • (String)


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

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

#hash_to_bib(hash) ⇒ RelatonGb::GbBibliographicItem

Parameters:

  • hash (Hash)

Returns:



30
31
32
# File 'lib/relaton_gb/processor.rb', line 30

def hash_to_bib(hash)
  ::RelatonGb::GbBibliographicItem.new hash
end