Class: Relaton::Nist::Processor

Inherits:
Core::Processor
  • Object
show all
Defined in:
lib/relaton/nist/processor.rb

Instance Method Summary collapse

Constructor Details

#initialize ⇒ Processor

rubocop:disable Lint/MissingSuper



6
7
8
9
10
11
12
# File 'lib/relaton/nist/processor.rb', line 6

def initialize # rubocop:disable Lint/MissingSuper
  @short = :relaton_nist
  @prefix = "NIST"
  @defaultprefix = %r{^(NIST|NBS|NISTGCR|ITL Bulletin|JPCRD|NISTIR|CSRC|FIPS)(/[^\s])?\s}
  @idtype = "NIST"
  @datasets = %w[nist-tech-pubs]
end

Instance Method Details

#fetch_data(_source, opts) ⇒ Object

Fetch all the documents from a source

Options Hash (opts):

  • :output (String) —

    directory to output documents

  • :format (String)


31
32
33
34
# File 'lib/relaton/nist/processor.rb', line 31

def fetch_data(_source, opts)
  require_relative "data_fetcher"
  DataFetcher.fetch(**opts)
end

#from_xml(xml) ⇒ Relaton::Nist::ItemData



38
39
40
41
# File 'lib/relaton/nist/processor.rb', line 38

def from_xml(xml)
  require_relative "../nist"
  Item.from_xml(xml)
end

#from_yaml(yaml) ⇒ Relaton::Nist::ItemData



45
46
47
48
# File 'lib/relaton/nist/processor.rb', line 45

def from_yaml(yaml)
  require_relative "../nist"
  Item.from_yaml(yaml)
end

#get(code, date = nil, opts = {}) ⇒ Relaton::Nist::ItemData



18
19
20
21
# File 'lib/relaton/nist/processor.rb', line 18

def get(code, date = nil, opts = {})
  require_relative "../nist"
  Bibliography.get(code, date, opts)
end

#grammar_hash ⇒ String

Returns hash of XML grammar



52
53
54
55
# File 'lib/relaton/nist/processor.rb', line 52

def grammar_hash
  require_relative "../nist"
  @grammar_hash ||= Nist.grammar_hash
end

#remove_index_file ⇒ Object

Remove index file



60
61
62
63
# File 'lib/relaton/nist/processor.rb', line 60

def remove_index_file
  require_relative "../nist"
  Relaton::Index.find_or_create(:nist, url: true, file: "#{INDEXFILE}.yaml").remove_file
end