Class: RelatonBipm::Processor
- Inherits:
-
Relaton::Processor
- Object
- Relaton::Processor
- RelatonBipm::Processor
- Defined in:
- lib/relaton_bipm/processor.rb
Instance Attribute Summary collapse
-
#idtype ⇒ Object
readonly
Returns the value of attribute idtype.
Instance Method Summary collapse
-
#fetch_data(source, opts) ⇒ Object
Fetch all the documents from github.com/metanorma/bipm-data-outcomes, github.com/metanorma/bipm-si-brochure, github.com/relaton/rawdata-bipm-metrologia.
- #from_xml(xml) ⇒ RelatonBipm::BipmBibliographicItem
- #get(code, date, opts) ⇒ RelatonBipm::BipmBibliographicItem
-
#grammar_hash ⇒ String
Returns hash of XML grammar.
- #hash_to_bib(hash) ⇒ RelatonBipm::BipmBibliographicItem
-
#initialize ⇒ Processor
constructor
A new instance of Processor.
-
#remove_index_file ⇒ Object
Remove index file.
Constructor Details
#initialize ⇒ Processor
Returns a new instance of Processor.
7 8 9 10 11 12 13 |
# File 'lib/relaton_bipm/processor.rb', line 7 def initialize @short = :relaton_bipm @prefix = "BIPM" @defaultprefix = %r{^(?:BIPM|CCTF|CCDS|CGPM|CIPM|JCRB|JCGM)(?!\w)} @idtype = "BIPM" @datasets = %w[bipm-data-outcomes bipm-si-brochure rawdata-bipm-metrologia] end |
Instance Attribute Details
#idtype ⇒ Object (readonly)
Returns the value of attribute idtype.
5 6 7 |
# File 'lib/relaton_bipm/processor.rb', line 5 def idtype @idtype end |
Instance Method Details
#fetch_data(source, opts) ⇒ Object
Fetch all the documents from github.com/metanorma/bipm-data-outcomes,
https://github.com/metanorma/bipm-si-brochure, https://github.com/relaton/rawdata-bipm-metrologia
33 34 35 |
# File 'lib/relaton_bipm/processor.rb', line 33 def fetch_data(source, opts) DataFetcher.fetch(source, **opts) end |
#from_xml(xml) ⇒ RelatonBipm::BipmBibliographicItem
39 40 41 |
# File 'lib/relaton_bipm/processor.rb', line 39 def from_xml(xml) ::RelatonBipm::XMLParser.from_xml xml end |
#get(code, date, opts) ⇒ RelatonBipm::BipmBibliographicItem
19 20 21 |
# File 'lib/relaton_bipm/processor.rb', line 19 def get(code, date, opts) ::RelatonBipm::BipmBibliography.get(code, date, opts) end |
#grammar_hash ⇒ String
Returns hash of XML grammar
51 52 53 |
# File 'lib/relaton_bipm/processor.rb', line 51 def grammar_hash @grammar_hash ||= ::RelatonBipm.grammar_hash end |
#hash_to_bib(hash) ⇒ RelatonBipm::BipmBibliographicItem
45 46 47 |
# File 'lib/relaton_bipm/processor.rb', line 45 def hash_to_bib(hash) ::RelatonBipm::BipmBibliographicItem.from_hash hash end |
#remove_index_file ⇒ Object
Remove index file
58 59 60 |
# File 'lib/relaton_bipm/processor.rb', line 58 def remove_index_file Relaton::Index.find_or_create(:bipm, url: true, file: BipmBibliography::INDEX_FILE).remove_file end |