Sha256: e3611d89c406c929635a21aa95eb6f795abd7b40eee10aa38e59e68fbb561ef3

Contents?: true

Size: 696 Bytes

Versions: 4

Compression:

Stored size: 696 Bytes

Contents

require 'marcel'
require 'rubyXL'
require 'berkeley_library/location/constants'
require 'berkeley_library/util/xlsx/spreadsheet'

module BerkeleyLibrary
  module Location
    class XLSXReader
      include Constants

      attr_reader :ss, :oclc_col_index

      def initialize(xlsx_path)
        @ss = Util::XLSX::Spreadsheet.new(xlsx_path)
        @oclc_col_index = ss.find_column_index_by_header!(OCLC_COL_HEADER)
      end

      def each_oclc_number
        return to_enum(:each_oclc_number) unless block_given?

        ss.each_value(oclc_col_index, include_header: false) do |v|
          next if (v_str = v.to_s).strip == ''

          yield v_str
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
berkeley_library-location-4.1.0 lib/berkeley_library/location/xlsx_reader.rb
berkeley_library-location-4.0.0 lib/berkeley_library/location/xlsx_reader.rb
berkeley_library-location-3.0.0 lib/berkeley_library/location/xlsx_reader.rb
berkeley_library-location-2.0.0 lib/berkeley_library/location/xlsx_reader.rb