Class: Relaton::Jis::Processor

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeProcessor

rubocop:disable Lint/MissingSuper



10
11
12
13
14
15
16
# File 'lib/relaton/jis/processor.rb', line 10

def initialize # rubocop:disable Lint/MissingSuper
  @short = :relaton_jis
  @prefix = "JIS"
  @defaultprefix = %r{^(JIS|TR)\s}
  @idtype = "JIS"
  @datasets = %w[jis-webdesk]
end

Instance Attribute Details

#idtypeObject (readonly)

Returns the value of attribute idtype.



8
9
10
# File 'lib/relaton/jis/processor.rb', line 8

def idtype
  @idtype
end

Instance Method Details

#fetch_data(_source, opts) ⇒ Object



23
24
25
26
# File 'lib/relaton/jis/processor.rb', line 23

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

#from_xml(xml) ⇒ Object



28
29
30
31
# File 'lib/relaton/jis/processor.rb', line 28

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

#from_yaml(yaml) ⇒ Object



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

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

#get(code, date, opts) ⇒ Object



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

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

#grammar_hashObject



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

def grammar_hash
  require_relative "../jis"
  Digest::MD5.hexdigest Relaton::Jis::VERSION + Relaton::Bib::VERSION
end

#remove_index_fileObject



47
48
49
50
51
52
# File 'lib/relaton/jis/processor.rb', line 47

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

#threadsObject



43
44
45
# File 'lib/relaton/jis/processor.rb', line 43

def threads
  3
end