Class: Relaton::Plateau::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/relaton/plateau/parser.rb

Overview

Base class for Plateau parsers

Direct Known Subclasses

HandbookParser, TechnicalReportParser

Constant Summary collapse

ATTRIS =
%i[docidentifier docnumber title abstract depiction edition type
date source contributor keyword ext].freeze

Instance Method Summary collapse

Constructor Details

#initialize(item, errors = {}) ⇒ Parser

Returns a new instance of Parser.



8
9
10
11
# File 'lib/relaton/plateau/parser.rb', line 8

def initialize(item, errors = {})
  @item = item
  @errors = errors
end

Instance Method Details

#parseObject



13
14
15
16
17
18
# File 'lib/relaton/plateau/parser.rb', line 13

def parse
  args = ATTRIS.each_with_object({}) do |attr, hash|
    hash[attr] = send("parse_#{attr}")
  end
  ItemData.new(**args)
end