Class: Relaton::Ietf::Processor

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

Instance Method Summary collapse

Constructor Details

#initializeProcessor

rubocop:disable Lint/MissingSuper



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

def initialize # rubocop:disable Lint/MissingSuper
  @short = :relaton_ietf
  @prefix = "IETF"
  @defaultprefix = /^((IETF|RFC|BCP|FYI|STD)\s|I-D[.\s])/
  @idtype = "IETF"
  @datasets = %w[ietf-rfcsubseries ietf-internet-drafts ietf-rfc-entries]
end

Instance Method Details

#fetch_data(source, opts) ⇒ Object

Fetch all the documents from www.rfc-editor.org/rfc-index.xml

Parameters:

  • source (String)

    source name

  • opts (Hash)

Options Hash (opts):

  • :output (String)

    directory to output documents

  • :format (String)


31
32
33
34
# File 'lib/relaton/ietf/processor.rb', line 31

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

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

Parameters:

  • xml (String)

Returns:



38
39
40
41
# File 'lib/relaton/ietf/processor.rb', line 38

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

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

Parameters:

  • yaml (String)

Returns:



45
46
47
48
# File 'lib/relaton/ietf/processor.rb', line 45

def from_yaml(yaml)
  require_relative "../ietf"
  Item.from_yaml yaml
end

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

Parameters:

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

    year

  • opts (Hash)

Returns:



18
19
20
21
# File 'lib/relaton/ietf/processor.rb', line 18

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

#grammar_hashString

Returns hash of XML grammar

Returns:

  • (String)


52
53
54
55
# File 'lib/relaton/ietf/processor.rb', line 52

def grammar_hash
  require_relative "../ietf"
  @grammar_hash ||= ::Relaton::Ietf.grammar_hash
end

#remove_index_fileObject

Remove index file



60
61
62
63
64
65
# File 'lib/relaton/ietf/processor.rb', line 60

def remove_index_file
  require_relative "../ietf"
  Relaton::Index.find_or_create(:RFC, url: true, file: "#{INDEXFILE}.yaml").remove_file
  Relaton::Index.find_or_create(:RSS, url: true, file: "#{INDEXFILE}.yaml").remove_file
  Relaton::Index.find_or_create(:IDS, url: true, file: "#{INDEXFILE}.yaml").remove_file
end