open-uri-cached 0.0.3 → 0.0.4

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.

Potentially problematic release.


This version of open-uri-cached might be problematic. Click here for more details.

Files changed (2) hide show
  1. data/lib/open-uri/cached.rb +3 -3
  2. metadata +3 -3
@@ -35,7 +35,7 @@ module OpenURI
35
35
  # Read metadata, if it exists
36
36
  meta = YAML::load(File.read("#{filename}.meta")) if File.exists?("#{filename}.meta")
37
37
 
38
- f = File.exists?(filename) ? StringIO.new(File.read(filename)) : nil
38
+ f = File.exists?(filename) ? StringIO.new(File.open(filename, "rb") { |f| f.read }) : nil
39
39
 
40
40
  # Add meta accessors
41
41
  if meta && f
@@ -85,11 +85,11 @@ module OpenURI
85
85
  meta[:status] = value.status if value.respond_to?(:status)
86
86
  meta[:content_type] = value.content_type if value.respond_to?(:content_type)
87
87
  meta[:base_uri] = value.base_uri if value.respond_to?(:base_uri)
88
- File.open(filename_meta, 'w') {|f| YAML::dump(meta, f)}
88
+ File.open(filename_meta, 'wb') {|f| YAML::dump(meta, f)}
89
89
  end
90
90
 
91
91
  # Save file contents
92
- File.open(filename, 'w'){|f| f.write value.read }
92
+ File.open(filename, 'wb'){|f| f.write value.read }
93
93
  value.rewind
94
94
  value
95
95
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 3
9
- version: 0.0.3
8
+ - 4
9
+ version: 0.0.4
10
10
  platform: ruby
11
11
  authors:
12
12
  - Danial Pearce
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-03-22 00:00:00 +11:00
17
+ date: 2011-05-19 00:00:00 +10:00
18
18
  default_executable:
19
19
  dependencies: []
20
20