Class: Relaton::ThreeGpp::Processor

Inherits:
Core::Processor
  • Object
show all
Defined in:
lib/relaton/3gpp/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/3gpp/processor.rb', line 8

def initialize # rubocop:disable Lint/MissingSuper
  @short = :relaton_3gpp
  @prefix = "3GPP"
  @defaultprefix = %r{^3GPP\s}
  @idtype = "3GPP"
  @datasets = %w[status-smg-3GPP status-smg-3GPP-force]
end

Instance Attribute Details

#idtypeObject (readonly)

Returns the value of attribute idtype.



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

def idtype
  @idtype
end

Instance Method Details

#fetch_data(source, opts) ⇒ Object

Parameters:

  • source (String)

    source name

  • opts (Hash)

Options Hash (opts):

  • :output (String)

    directory to output documents

  • :format (String)


33
34
35
36
# File 'lib/relaton/3gpp/processor.rb', line 33

def fetch_data(source, opts)
  require_relative "data_fetcher"
  DataFetcher.fetch(source, **opts)
end

#from_xml(xml) ⇒ RelatonBib::BibliographicItem

Parameters:

  • xml (String)

Returns:

  • (RelatonBib::BibliographicItem)


40
41
42
43
# File 'lib/relaton/3gpp/processor.rb', line 40

def from_xml(xml)
  require_relative "../3gpp"
  Item.from_xml xml
end

#from_yaml(yaml) ⇒ Relaton::ThreeGpp::Item

Parameters:

  • yaml (String)

Returns:



47
48
49
50
# File 'lib/relaton/3gpp/processor.rb', line 47

def from_yaml(yaml)
  require_relative "../3gpp"
  Item.from_yaml(yaml)
end

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

Parameters:

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

    year

  • opts (Hash)

Returns:

  • (RelatonBib::BibliographicItem)


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

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

#grammar_hashString

Returns hash of XML grammar

Returns:

  • (String)


54
55
56
57
# File 'lib/relaton/3gpp/processor.rb', line 54

def grammar_hash
  require_relative "../3gpp"
  @grammar_hash ||= ThreeGpp.grammar_hash
end

#remove_index_fileObject

Remove index file



62
63
64
65
# File 'lib/relaton/3gpp/processor.rb', line 62

def remove_index_file
  require_relative "../3gpp"
  Relaton::Index.find_or_create("3GPP", url: true, file: "#{INDEXFILE}.yaml").remove_file
end