Class: Relaton::Iec::Processor
- Inherits:
-
Core::Processor
- Object
- Core::Processor
- Relaton::Iec::Processor
- Defined in:
- lib/relaton/iec/processor.rb
Instance Method Summary collapse
-
#fetch_data(source, opts) ⇒ Object
Fetch all the documents from a source.
- #from_xml(xml) ⇒ Relaton::Iec::ItemData
- #from_yaml(yaml) ⇒ Relaton::Iec::ItemData
- #get(code, date, opts) ⇒ Relaton::Iec::ItemData?
-
#grammar_hash ⇒ String
Returns hash of XML grammar.
-
#initialize ⇒ Processor
constructor
A new instance of Processor.
-
#remove_index_file ⇒ Object
Remove index file.
- #urn_to_code(code) ⇒ String?
Constructor Details
#initialize ⇒ Processor
Returns a new instance of Processor.
6 7 8 9 10 11 12 |
# File 'lib/relaton/iec/processor.rb', line 6 def initialize @short = :relaton_iec @prefix = "IEC" @defaultprefix = %r{^(IEC\s|CISPR\s|IEV($|\s))} @idtype = "IEC" @datasets = %w[iec-harmonized-all iec-harmonized-latest] end |
Instance Method Details
#fetch_data(source, opts) ⇒ Object
Fetch all the documents from a source
31 32 33 34 |
# File 'lib/relaton/iec/processor.rb', line 31 def fetch_data(source, opts) require_relative "data_fetcher" DataFetcher.fetch(source, **opts) end |
#from_xml(xml) ⇒ Relaton::Iec::ItemData
38 39 40 41 |
# File 'lib/relaton/iec/processor.rb', line 38 def from_xml(xml) require_relative "../iec" Item.from_xml xml end |
#from_yaml(yaml) ⇒ Relaton::Iec::ItemData
45 46 47 48 |
# File 'lib/relaton/iec/processor.rb', line 45 def from_yaml(yaml) require_relative "../iec" Item.from_yaml yaml end |
#get(code, date, opts) ⇒ Relaton::Iec::ItemData?
18 19 20 21 |
# File 'lib/relaton/iec/processor.rb', line 18 def get(code, date, opts) require_relative "../iec" Bibliography.get(code, date, opts) end |
#grammar_hash ⇒ String
Returns hash of XML grammar
52 53 54 55 |
# File 'lib/relaton/iec/processor.rb', line 52 def grammar_hash require_relative "../iec" @grammar_hash ||= ::Relaton::Iec.grammar_hash end |
#remove_index_file ⇒ Object
Remove index file
67 68 69 70 |
# File 'lib/relaton/iec/processor.rb', line 67 def remove_index_file require_relative "../iec" Relaton::Index.find_or_create(:iec, url: true, file: "#{INDEXFILE}.yaml").remove_file end |
#urn_to_code(code) ⇒ String?
59 60 61 62 |
# File 'lib/relaton/iec/processor.rb', line 59 def urn_to_code(code) require_relative "../iec" Relaton::Iec.urn_to_code code end |