Class: BerkeleyLibrary::Location::XLSXWriter

Inherits:
Object
  • Object
show all
Includes:
Constants, BerkeleyLibrary::Logging
Defined in:
lib/berkeley_library/location/xlsx_writer.rb

Constant Summary collapse

COL_NRLF =
'NRLF'.freeze
COL_SRLF =
'SRLF'.freeze
COL_OTHER_UC =
'Other UC'.freeze
COL_WC_ERROR =
'WorldCat Error'.freeze
COL_HATHI_TRUST =
'Hathi Trust'.freeze
COL_HATHI_TRUST_ERROR =
"#{COL_HATHI_TRUST} Error".freeze
V_NRLF =
'nrlf'.freeze
V_SRLF =
'srlf'.freeze

Constants included from Constants

Constants::OCLC_COL_HEADER

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ss, rlf: true, uc: true, hathi_trust: true) ⇒ XLSXWriter

Returns a new instance of XLSXWriter.



23
24
25
26
27
28
29
30
# File 'lib/berkeley_library/location/xlsx_writer.rb', line 23

def initialize(ss, rlf: true, uc: true, hathi_trust: true)
  @ss = ss
  @rlf = rlf
  @uc = uc
  @hathi_trust = hathi_trust

  ensure_columns!
end

Instance Attribute Details

#hathi_trustObject (readonly)

Returns the value of attribute hathi_trust.



21
22
23
# File 'lib/berkeley_library/location/xlsx_writer.rb', line 21

def hathi_trust
  @hathi_trust
end

#rlfObject (readonly)

Returns the value of attribute rlf.



21
22
23
# File 'lib/berkeley_library/location/xlsx_writer.rb', line 21

def rlf
  @rlf
end

#ssObject (readonly)

Returns the value of attribute ss.



21
22
23
# File 'lib/berkeley_library/location/xlsx_writer.rb', line 21

def ss
  @ss
end

#ucObject (readonly)

Returns the value of attribute uc.



21
22
23
# File 'lib/berkeley_library/location/xlsx_writer.rb', line 21

def uc
  @uc
end

Instance Method Details

#<<(result) ⇒ Object



32
33
34
35
36
37
38
# File 'lib/berkeley_library/location/xlsx_writer.rb', line 32

def <<(result)
  r_indices = row_indices_for(result.oclc_number)
  r_indices.each do |idx|
    write_wc_cols(idx, result) if rlf || uc
    write_ht_cols(idx, result) if hathi_trust
  end
end