Class: RelatonW3c::Processor
- Inherits:
-
Relaton::Processor
- Object
- Relaton::Processor
- RelatonW3c::Processor
- Defined in:
- lib/relaton_w3c/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 www.w3.org/2002/01/tr-automation/tr.rdf.
- #from_xml(xml) ⇒ RelatonCalconnect::CcBibliographicItem
- #get(code, date, opts) ⇒ RelatonW3C::W3cBibliographicItem
-
#grammar_hash ⇒ String
Returns hash of XML grammar.
- #hash_to_bib(hash) ⇒ RelatonIsoBib::CcBibliographicItem
-
#initialize ⇒ Processor
constructor
rubocop:disable Lint/MissingSuper.
-
#remove_index_file ⇒ Object
Remove index file.
Constructor Details
#initialize ⇒ Processor
rubocop:disable Lint/MissingSuper
7 8 9 10 11 12 13 |
# File 'lib/relaton_w3c/processor.rb', line 7 def initialize # rubocop:disable Lint/MissingSuper @short = :relaton_w3c @prefix = "W3C" @defaultprefix = %r{^W3C\s} @idtype = "W3C" @datasets = %w[w3c-rdf] end |
Instance Attribute Details
#idtype ⇒ Object (readonly)
Returns the value of attribute idtype.
5 6 7 |
# File 'lib/relaton_w3c/processor.rb', line 5 def idtype @idtype end |
Instance Method Details
#fetch_data(_source, opts) ⇒ Object
Fetch all the documents from www.w3.org/2002/01/tr-automation/tr.rdf
31 32 33 |
# File 'lib/relaton_w3c/processor.rb', line 31 def fetch_data(_source, opts) DataFetcher.fetch(**opts) end |
#from_xml(xml) ⇒ RelatonCalconnect::CcBibliographicItem
37 38 39 |
# File 'lib/relaton_w3c/processor.rb', line 37 def from_xml(xml) ::RelatonW3c::XMLParser.from_xml xml end |
#get(code, date, opts) ⇒ RelatonW3C::W3cBibliographicItem
19 20 21 |
# File 'lib/relaton_w3c/processor.rb', line 19 def get(code, date, opts) ::RelatonW3c::W3cBibliography.get(code, date, opts) end |
#grammar_hash ⇒ String
Returns hash of XML grammar
50 51 52 |
# File 'lib/relaton_w3c/processor.rb', line 50 def grammar_hash @grammar_hash ||= ::RelatonW3c.grammar_hash end |
#hash_to_bib(hash) ⇒ RelatonIsoBib::CcBibliographicItem
43 44 45 46 |
# File 'lib/relaton_w3c/processor.rb', line 43 def hash_to_bib(hash) item_hash = ::RelatonW3c::HashConverter.hash_to_bib(hash) ::RelatonW3c::W3cBibliographicItem.new(**item_hash) end |
#remove_index_file ⇒ Object
Remove index file
57 58 59 |
# File 'lib/relaton_w3c/processor.rb', line 57 def remove_index_file Relaton::Index.find_or_create(:W3C, url: true, file: "#{W3cBibliography::INDEX}.yaml").remove_file end |