Class: Relaton::Ogc::Processor

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

Instance Method Summary collapse

Constructor Details

#initializeProcessor

rubocop:disable Lint/MissingSuper



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

def initialize # rubocop:disable Lint/MissingSuper
  @short = :relaton_ogc
  @prefix = "OGC"
  @defaultprefix = %r{^OGC\s}
  @idtype = "OGC"
  @datasets = %w[ogc-naming-authority]
end

Instance Method Details

#fetch_data(_source, opts) ⇒ Object

Parameters:

  • source (String)
  • opts (Hash)


25
26
27
28
# File 'lib/relaton/ogc/processor.rb', line 25

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

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

Parameters:

  • xml (String)

Returns:



32
33
34
35
# File 'lib/relaton/ogc/processor.rb', line 32

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

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

Parameters:

  • yaml (String)

Returns:



39
40
41
42
# File 'lib/relaton/ogc/processor.rb', line 39

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

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

Parameters:

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

Returns:



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

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

#grammar_hashString

Returns:

  • (String)


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

def grammar_hash
  require_relative "../ogc"
  @grammar_hash ||= Relaton::Ogc.grammar_hash
end

#remove_index_fileObject



50
51
52
53
54
55
# File 'lib/relaton/ogc/processor.rb', line 50

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