lib/worksheet.rb in rxl-0.6.0 vs lib/worksheet.rb in rxl-0.6.1
- old
+ new
@@ -1,7 +1,6 @@
require 'rubyXL'
-require 'mitrush'
require_relative 'cell'
require_relative 'cells'
module Worksheet
@@ -13,11 +12,11 @@
rubyxl_rows = rubyxl_worksheet.map do |rubyxl_row|
{ rubyxl_row: rubyxl_row, rubyxl_row_index: rubyxl_row ? rubyxl_row.r - 1 : nil }
end
hash_worksheet = Cells.rubyxl_to_hash(rubyxl_rows)
process_sheet_to_populated_block(hash_worksheet)
- Mitrush.delete_keys(hash_worksheet, %i[row_count column_count])
+ hash_worksheet.delete_if { |key, _| %i[row_count column_count].include?(key) }
hash_worksheet
end
########################################################
@@ -100,10 +99,10 @@
####################################
### OTHER PUBLIC METHODS ###
####################################
def self.hash_worksheet_to_hash_table(raw_hash)
- cells = Mitrush.deep_copy(raw_hash)
+ cells = Marshal.load(Marshal.dump(raw_hash)) # deep copy the raw_hash
columns = cells.keys.map { |key| key[/\D+/] }.uniq
columns.delete_if { |item| cells["#{item}1"][:value].nil? }
row_nums = cells.keys.map { |key| key[/\d+/].to_i }.uniq[1..-1] || []
row_nums.sort! unless row_nums.empty?
row_nums.map do |row_number|
\ No newline at end of file