From 8b28c7bd5b3d6b354e67538020fad272d8f6e119 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Begejowicz?= Date: Tue, 23 Apr 2019 14:36:58 +0200 Subject: [PATCH] Remove HTTP dependency --- README.md | 7 ------- creek.gemspec | 1 - lib/creek/book.rb | 10 ++-------- 3 files changed, 2 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index ea287db..1e7723b 100644 --- a/README.md +++ b/README.md @@ -93,13 +93,6 @@ puts sheet.images_at('C1') # => nil Creek will most likely return nil for a cell with images if there is no other text cell in that row - you can use *images_at* method for retrieving images in that cell. -## Remote files - -```ruby -remote_url = 'http://dev-builds.libreoffice.org/tmp/test.xlsx' -Creek::Book.new remote_url, remote: true -``` - ## Contributing Contributions are welcomed. You can fork a repository, add your code changes to the forked branch, ensure all existing unit tests pass, create new unit tests which cover your new changes and finally create a pull request. diff --git a/creek.gemspec b/creek.gemspec index 7ad309f..316b1d6 100644 --- a/creek.gemspec +++ b/creek.gemspec @@ -27,5 +27,4 @@ Gem::Specification.new do |spec| spec.add_dependency 'nokogiri', '>= 1.7.0' spec.add_dependency 'rubyzip', '>= 1.0.0' - spec.add_dependency 'http', '~> 4.0' end diff --git a/lib/creek/book.rb b/lib/creek/book.rb index 613cac6..d32e964 100644 --- a/lib/creek/book.rb +++ b/lib/creek/book.rb @@ -1,7 +1,7 @@ require 'zip/filesystem' require 'nokogiri' require 'date' -require 'http' +require 'time' module Creek @@ -20,13 +20,7 @@ def initialize path, options = {} extension = File.extname(options[:original_filename] || path).downcase raise 'Not a valid file format.' unless (['.xlsx', '.xlsm'].include? extension) end - if options[:remote] - zipfile = Tempfile.new("file") - zipfile.binmode - zipfile.write(HTTP.get(path).to_s) - zipfile.close - path = zipfile.path - end + @files = Zip::File.open(path) @shared_strings = SharedStrings.new(self) end