Sha256: f35495a6a48b952211a835bb1adfdebd69e3c1a151ba51e46b32c7ec13256675

Contents?: true

Size: 696 Bytes

Versions: 5

Compression:

Stored size: 696 Bytes

Contents

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

module BerkeleyLibrary
  module Holdings
    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

5 entries across 5 versions & 1 rubygems

Version Path
berkeley_library-holdings-1.0.5 lib/berkeley_library/holdings/xlsx_reader.rb
berkeley_library-holdings-1.0.4 lib/berkeley_library/holdings/xlsx_reader.rb
berkeley_library-holdings-1.0.3 lib/berkeley_library/holdings/xlsx_reader.rb
berkeley_library-holdings-1.0.2 lib/berkeley_library/holdings/xlsx_reader.rb
berkeley_library-holdings-1.0.1 lib/berkeley_library/holdings/xlsx_reader.rb