Class: Relaton::Iso::Processor

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeProcessor

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-ics]
end

Instance Attribute Details

#idtypeObject (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

Parameters:

  • source (String)

    source name (iso-rss, iso-rss-all)

  • opts (Hash)

Options Hash (opts):

  • :output (String)

    directory to output documents

  • :format (String)

    output format (xml, yaml, bibxml)



33
34
35
36
# File 'lib/relaton/iso/processor.rb', line 33

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

#from_xml(xml) ⇒ RelatonIsoBib::IsoBibliographicItem

Parameters:

  • xml (String)

Returns:

  • (RelatonIsoBib::IsoBibliographicItem)


40
41
42
43
# File 'lib/relaton/iso/processor.rb', line 40

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

#from_yaml(yaml) ⇒ Object



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

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

#get(code, date, opts) ⇒ RelatonIsoBib::IsoBibliographicItem

Parameters:

  • code (String)
  • date (String, nil)

    year

  • opts (Hash)

Returns:

  • (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_hashString

Returns hash of XML grammar

Returns:

  • (String)


59
60
61
62
# File 'lib/relaton/iso/processor.rb', line 59

def grammar_hash
  require_relative "../iso"
  Iso.grammar_hash
end

#remove_index_fileObject

Remove index file



71
72
73
74
# File 'lib/relaton/iso/processor.rb', line 71

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

#threadsInteger

Returns number of workers

Returns:

  • (Integer)


66
# File 'lib/relaton/iso/processor.rb', line 66

def threads = 3