Class: RelatonIetf::Processor
- Inherits:
-
Relaton::Processor
- Object
- Relaton::Processor
- RelatonIetf::Processor
- Defined in:
- lib/relaton_ietf/processor.rb
Instance Method Summary collapse
-
#fetch_data(source, opts) ⇒ Object
Fetch all the documents from www.rfc-editor.org/rfc-index.xml.
- #from_xml(xml) ⇒ RelatonIetf::IetfBibliographicItem
- #get(code, date, opts) ⇒ RelatonIetf::IetfBibliographicItem
-
#grammar_hash ⇒ String
Returns hash of XML grammar.
- #hash_to_bib(hash) ⇒ RelatonIetf::IetfBibliographicItem
-
#initialize ⇒ Processor
constructor
rubocop:disable Lint/MissingSuper.
-
#remove_index_file ⇒ Object
Remove index file.
Constructor Details
#initialize ⇒ Processor
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
30 31 32 |
# File 'lib/relaton_ietf/processor.rb', line 30 def fetch_data(source, opts) DataFetcher.fetch(source, **opts) end |
#from_xml(xml) ⇒ RelatonIetf::IetfBibliographicItem
36 37 38 |
# File 'lib/relaton_ietf/processor.rb', line 36 def from_xml(xml) ::RelatonIetf::XMLParser.from_xml xml end |
#get(code, date, opts) ⇒ RelatonIetf::IetfBibliographicItem
18 19 20 |
# File 'lib/relaton_ietf/processor.rb', line 18 def get(code, date, opts) ::RelatonIetf::IetfBibliography.get(code, date, opts) end |
#grammar_hash ⇒ String
Returns hash of XML grammar
48 49 50 |
# File 'lib/relaton_ietf/processor.rb', line 48 def grammar_hash @grammar_hash ||= ::RelatonIetf.grammar_hash end |
#hash_to_bib(hash) ⇒ RelatonIetf::IetfBibliographicItem
42 43 44 |
# File 'lib/relaton_ietf/processor.rb', line 42 def hash_to_bib(hash) ::RelatonIetf::IetfBibliographicItem.from_hash hash end |
#remove_index_file ⇒ Object
Remove index file
55 56 57 58 59 |
# File 'lib/relaton_ietf/processor.rb', line 55 def remove_index_file Relaton::Index.find_or_create(:RFC, url: true, file: Scrapper::INDEX_FILE).remove_file Relaton::Index.find_or_create(:RSS, url: true, file: Scrapper::INDEX_FILE).remove_file Relaton::Index.find_or_create(:IDS, url: true, file: Scrapper::INDEX_FILE).remove_file end |