flying-sphinx 1.2.1 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,18 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "appraisal", "~> 1.0.0", :git => "git://github.com/thoughtbot/appraisal", :branch => "master", :ref => "bd6eef4b6a"
6
- gem "rails", "~> 4.0.5"
7
- gem "faraday", "~> 0.9.0"
8
- if RUBY_VERSION.to_f <= 1.8
9
- gem "public_suffix", "< 1.4.0"
10
- elsif RUBY_VERSION.to_f <= 1.9
11
- gem "public_suffix", "< 1.5.0"
12
- elsif RUBY_VERSION.to_f <= 2.0
13
- gem "public_suffix", "< 1.5.0"
14
- else
15
- gem "public_suffix"
16
- end
17
-
18
- gemspec :path => "../"
@@ -1,36 +0,0 @@
1
- require 'zlib'
2
-
3
- class FlyingSphinx::GzippedHash
4
- def initialize(hash)
5
- @hash = hash
6
- end
7
-
8
- def to_gzipped_hash
9
- hash['gzip'] = 'true'
10
-
11
- keys.each { |key| hash[key] = gzip hash[key], key }
12
-
13
- hash
14
- end
15
-
16
- private
17
-
18
- attr_reader :hash
19
-
20
- def keys
21
- keys = (hash['extra'] || '').split(';')
22
- keys << 'sphinx' if hash['sphinx']
23
- keys
24
- end
25
-
26
- def gzip(string, key)
27
- io = StringIO.new 'w'
28
- writer = Zlib::GzipWriter.new io
29
- writer.write string
30
- writer.close
31
-
32
- Faraday::UploadIO.new(
33
- StringIO.new(io.string, 'rb'), 'application/gzip', key
34
- )
35
- end
36
- end