Class: Relaton::Cie::Processor

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

Instance Method Summary collapse

Constructor Details

#initializeProcessor

rubocop:disable Lint/MissingSuper



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

def initialize # rubocop:disable Lint/MissingSuper
  @short = :relaton_cie
  @prefix = "CIE"
  @defaultprefix = /^CIE(-|\s)/
  @idtype = "CIE"
  @datasets = %w[cie-techstreet]
end

Instance Method Details

#fetch_data(_source, opts) ⇒ Object

Fetch all the docukents from a source

Parameters:

  • _source (String)

    source name

  • opts (Hash)

Options Hash (opts):

  • :output (String)

    directory to output documents

  • :format (String)


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

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

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

Parameters:

  • xml (String)

Returns:



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

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

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

Parameters:

  • hash (String)

Returns:



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

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

#get(code, date, opts) ⇒ Relaton::Cie::ItemData?

Parameters:

  • code (String)
  • date (String, NilClass)

    year

  • opts (Hash)

Returns:



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

def get(code, date, opts)
  require_relative "../cie"
  Bibliography.get(code, date, opts)
end

#grammar_hashString

Returns hash of XML grammar

Returns:

  • (String)


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

def grammar_hash
  require_relative "../cie"
  @grammar_hash ||= Cie.grammar_hash
end

#remove_index_fileObject

Remove index file



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

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