Class: LibPtgBox::Unmarshaller::Kbart

Inherits:
Object
  • Object
show all
Defined in:
app/modules/lib_ptg_box/unmarshaller/kbart.rb

Instance Method Summary collapse

Constructor Details

#initialize(line) ⇒ Kbart


8
9
10
11
12
13
14
15
16
17
18
# File 'app/modules/lib_ptg_box/unmarshaller/kbart.rb', line 8

def initialize(line)
  @line = line.force_encoding('UTF-16BE').encode('UTF-8')
  begin
    CSV.parse(@line) do |row|
      @row = row
    end
  rescue StandardError => e
    Rails.logger.error("LibPtgBox::Unmarshaller::Kbart.initialize(#{@line}) error " + e.to_s)
    @row = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, "10.3998/mpub.00000000"]
  end
end

Instance Method Details

#doiObject


20
21
22
# File 'app/modules/lib_ptg_box/unmarshaller/kbart.rb', line 20

def doi
  @doi ||= @row[11]
end