Class: Relaton::Iso::Processor
- Inherits:
-
Core::Processor
- Object
- Core::Processor
- Relaton::Iso::Processor
- Defined in:
- lib/relaton/iso/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 the ISO Open Data programme (www.iso.org/open-data.html).
- #from_xml(xml) ⇒ RelatonIsoBib::IsoBibliographicItem
- #from_yaml(yaml) ⇒ Object
- #get(code, date, opts) ⇒ RelatonIsoBib::IsoBibliographicItem
-
#grammar_hash ⇒ String
Returns hash of XML grammar.
-
#initialize ⇒ Processor
constructor
rubocop:disable Lint/MissingSuper.
-
#remove_index_file ⇒ Object
Remove index file.
-
#threads ⇒ Integer
Returns number of workers.
Constructor Details
#initialize ⇒ Processor
rubocop:disable Lint/MissingSuper
8 9 10 11 12 13 14 |
# File 'lib/relaton/iso/processor.rb', line 8 def initialize # rubocop:disable Lint/MissingSuper @short = :relaton_iso @prefix = "ISO" @defaultprefix = %r{^ISO(/IEC)?\s} @idtype = "ISO" @datasets = %w[iso-open-data iso-open-data-all] end |
Instance Attribute Details
#idtype ⇒ Object (readonly)
Returns the value of attribute idtype.
6 7 8 |
# File 'lib/relaton/iso/processor.rb', line 6 def idtype @idtype end |
Instance Method Details
#fetch_data(source, opts) ⇒ Object
Fetch all the documents from the ISO Open Data programme (www.iso.org/open-data.html).
36 37 38 39 |
# File 'lib/relaton/iso/processor.rb', line 36 def fetch_data(source, opts) require_relative "data_fetcher" DataFetcher.fetch(source, **opts) end |
#from_xml(xml) ⇒ RelatonIsoBib::IsoBibliographicItem
43 44 45 46 |
# File 'lib/relaton/iso/processor.rb', line 43 def from_xml(xml) require_relative "../iso" Item.from_xml xml end |
#from_yaml(yaml) ⇒ Object
48 49 50 51 |
# File 'lib/relaton/iso/processor.rb', line 48 def from_yaml(yaml) require_relative "../iso" Item.from_yaml yaml end |
#get(code, date, opts) ⇒ RelatonIsoBib::IsoBibliographicItem
20 21 22 23 |
# File 'lib/relaton/iso/processor.rb', line 20 def get(code, date, opts) require_relative "../iso" Bibliography.get(code, date, opts) end |
#grammar_hash ⇒ String
Returns hash of XML grammar
62 63 64 65 |
# File 'lib/relaton/iso/processor.rb', line 62 def grammar_hash require_relative "../iso" Iso.grammar_hash end |
#remove_index_file ⇒ Object
Remove index file
74 75 76 77 |
# File 'lib/relaton/iso/processor.rb', line 74 def remove_index_file require_relative "hit_collection" Index.find_or_create(:iso, url: true, file: "#{INDEXFILE}.yaml").remove_file end |
#threads ⇒ Integer
Returns number of workers
69 |
# File 'lib/relaton/iso/processor.rb', line 69 def threads = 3 |