Class: Relaton::Iho::Processor

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeProcessor

Returns a new instance of Processor.



8
9
10
11
12
13
# File 'lib/relaton/iho/processor.rb', line 8

def initialize
  @short = :relaton_iho
  @prefix = "IHO"
  @defaultprefix = %r{^IHO\s}
  @idtype = "IHO"
end

Instance Attribute Details

#idtypeObject (readonly)

Returns the value of attribute idtype.



6
7
8
# File 'lib/relaton/iho/processor.rb', line 6

def idtype
  @idtype
end

Instance Method Details

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

Parameters:

  • xml (String)

Returns:



26
27
28
29
# File 'lib/relaton/iho/processor.rb', line 26

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

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

Parameters:

  • yaml (String)

Returns:



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

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

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

Parameters:

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

    year

  • opts (Hash)

Returns:



19
20
21
22
# File 'lib/relaton/iho/processor.rb', line 19

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

#grammar_hashString

Returns hash of XML grammar

Returns:

  • (String)


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

def grammar_hash
  require_relative "../iho"
  @grammar_hash ||= ::Relaton::Iho.grammar_hash
end

#remove_index_fileObject

Remove index file



48
49
50
51
# File 'lib/relaton/iho/processor.rb', line 48

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