Sha256: 82f1286d6b6038bdb7bf917644d9044c37a584b9953a51edc4ef1a1101fdd781

Contents?: true

Size: 622 Bytes

Versions: 1

Compression:

Stored size: 622 Bytes

Contents

module GoogleDrive
	class Worksheet

		def export_hash hash
			begin
				self.list.push hash #will raise error if unfamiliar key. faster than making a request everytime asking for present keys.
			rescue GoogleDrive::Error => error #GoogleDrive::Error: Column doesn't exist: "hi"
				if error.message.include? "Column doesn't exist:" 
					old_keys = self.list.keys # then update all keys, because it'll take same amount of time as updating specific keys
					new_keys = (old_keys + hash.keys).uniq 
					self.list.keys = new_keys #we are updating the first row.
					retry
				end
				raise
			end
			
		end

		

	end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
model_to_googlesheet-1.0.0 lib/model_to_googlesheet/google_drive/worksheet.rb