Class: Relaton::Plateau::Processor
- Inherits:
-
Relaton::Processor
- Object
- Relaton::Processor
- Relaton::Plateau::Processor
- Defined in:
- lib/relaton/plateau/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.mlit.go.jp/plateau.
- #from_xml(xml) ⇒ Relaton::Plateau::BibItem
-
#get(code, date, opts) ⇒ Relaton::Plateau::BibliographicItem
Relaton::Plateau::BibliographicItem.
-
#grammar_hash ⇒ String
Returns hash of XML grammar.
- #hash_to_bib(hash) ⇒ Relaton:Plateau::BibItem
-
#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/plateau/processor.rb', line 8 def initialize # rubocop:disable Lint/MissingSuper @short = :"relaton/plateau" @prefix = "PLATEAU" @defaultprefix = /^PLATEAU\s/ @idtype = "PLATEAU" @datasets = %w[plateau-handbooks plateau-technical-reports] end |
Instance Attribute Details
#idtype ⇒ Object (readonly)
Returns the value of attribute idtype.
6 7 8 |
# File 'lib/relaton/plateau/processor.rb', line 6 def idtype @idtype end |
Instance Method Details
#fetch_data(source, opts) ⇒ Object
Fetch all the documents from www.mlit.go.jp/plateau
32 33 34 |
# File 'lib/relaton/plateau/processor.rb', line 32 def fetch_data(source, opts) Fetcher.fetch(source, **opts) end |
#from_xml(xml) ⇒ Relaton::Plateau::BibItem
38 39 40 |
# File 'lib/relaton/plateau/processor.rb', line 38 def from_xml(xml) ::Relaton::Plateau::XMLParser.from_xml xml end |
#get(code, date, opts) ⇒ Relaton::Plateau::BibliographicItem
Returns Relaton::Plateau::BibliographicItem.
20 21 22 |
# File 'lib/relaton/plateau/processor.rb', line 20 def get(code, date, opts) ::Relaton::Plateau::Bibliography.get(code, date, opts) end |
#grammar_hash ⇒ String
Returns hash of XML grammar
51 52 53 |
# File 'lib/relaton/plateau/processor.rb', line 51 def grammar_hash @grammar_hash ||= ::Relaton::Plateau.grammar_hash end |
#hash_to_bib(hash) ⇒ Relaton:Plateau::BibItem
44 45 46 47 |
# File 'lib/relaton/plateau/processor.rb', line 44 def hash_to_bib(hash) item_hash = HashConverter.hash_to_bib(hash) ::Relaton::Plateau::BibItem.new(**item_hash) end |
#remove_index_file ⇒ Object
Remove index file
64 65 66 |
# File 'lib/relaton/plateau/processor.rb', line 64 def remove_index_file Relaton::Index.find_or_create(:plateau, url: true, file: "#{Bibliography::INDEXFILE}.yaml").remove_file end |
#threads ⇒ Integer
Returns number of workers
57 58 59 |
# File 'lib/relaton/plateau/processor.rb', line 57 def threads 3 end |