Class: BerkeleyLibrary::Holdings::XLSXReader
- Inherits:
-
Object
- Object
- BerkeleyLibrary::Holdings::XLSXReader
- Includes:
- Constants
- Defined in:
- lib/berkeley_library/holdings/xlsx_reader.rb
Constant Summary
Constants included from Constants
Instance Attribute Summary collapse
-
#oclc_col_index ⇒ Object
readonly
Returns the value of attribute oclc_col_index.
-
#ss ⇒ Object
readonly
Returns the value of attribute ss.
Instance Method Summary collapse
- #each_oclc_number ⇒ Object
-
#initialize(xlsx_path) ⇒ XLSXReader
constructor
A new instance of XLSXReader.
Constructor Details
#initialize(xlsx_path) ⇒ XLSXReader
Returns a new instance of XLSXReader.
13 14 15 16 |
# File 'lib/berkeley_library/holdings/xlsx_reader.rb', line 13 def initialize(xlsx_path) @ss = Util::XLSX::Spreadsheet.new(xlsx_path) @oclc_col_index = ss.find_column_index_by_header!(OCLC_COL_HEADER) end |
Instance Attribute Details
#oclc_col_index ⇒ Object (readonly)
Returns the value of attribute oclc_col_index.
11 12 13 |
# File 'lib/berkeley_library/holdings/xlsx_reader.rb', line 11 def oclc_col_index @oclc_col_index end |
#ss ⇒ Object (readonly)
Returns the value of attribute ss.
11 12 13 |
# File 'lib/berkeley_library/holdings/xlsx_reader.rb', line 11 def ss @ss end |
Instance Method Details
#each_oclc_number ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/berkeley_library/holdings/xlsx_reader.rb', line 18 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 |