viki_utils 0.0.4 → 0.0.5

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.
@@ -33,10 +33,10 @@ module Viki
33
33
  private
34
34
 
35
35
  def dump(body)
36
- serializable = body.select { |k, v| !v.is_a?(IO) }
36
+ serializable = body.reject { |k, v| is_file? v }
37
37
  response = Oj.dump(serializable)
38
38
 
39
- files = body.select { |k, v| v.is_a?(IO) }.values
39
+ files = body.select { |k, v| is_file? v }.values
40
40
  files.each do |f|
41
41
  response += Digest::MD5.hexdigest f.read
42
42
  f.rewind
@@ -44,5 +44,9 @@ module Viki
44
44
 
45
45
  response
46
46
  end
47
+
48
+ def is_file?(value)
49
+ value.is_a?(IO) || (value.respond_to?(:tempfile) && value.tempfile.is_a?(IO))
50
+ end
47
51
  end
48
52
  end
@@ -1,3 +1,3 @@
1
1
  module VikiUtils
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: viki_utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: