Class: Relaton::Gb::Processor

Inherits:
Core::Processor
  • Object
show all
Defined in:
lib/relaton/gb/processor.rb

Instance Method Summary collapse

Constructor Details

#initializeProcessor

Returns a new instance of Processor.



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

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

Instance Method Details

#from_xml(xml) ⇒ Relaton::Gb::ItemData

Parameters:

  • xml (String)

Returns:



26
27
28
29
# File 'lib/relaton/gb/processor.rb', line 26

def from_xml(xml)
  require_relative "../gb"
  Item.from_xml xml
end

#from_yaml(yaml) ⇒ Relaton::Gb::ItemData

Parameters:

  • yaml (String)

Returns:



33
34
35
# File 'lib/relaton/gb/processor.rb', line 33

def from_yaml(yaml)
  Item.from_yaml yaml
end

#get(code, date, opts) ⇒ Relaton::Gb::ItemData?

Parameters:

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

    year

  • opts (Hash)

Returns:



19
20
21
22
# File 'lib/relaton/gb/processor.rb', line 19

def get(code, date, opts)
  require_relative "../gb"
  Bibliography.get(code, date, opts)
end

#grammar_hashString

Returns hash of XML grammar

Returns:

  • (String)


39
40
41
42
# File 'lib/relaton/gb/processor.rb', line 39

def grammar_hash
  require_relative "../gb"
  @grammar_hash ||= ::Relaton::Gb.grammar_hash
end